1
0
Fork 0
Commit Graph

298 Commits

Author SHA1 Message Date
Christian Kamm 6b571b609c
Conflicts: Rename BasePath to InitialBasePath #6709 2020-12-15 10:58:05 +01:00
Olivier Goffart d81ccbb0c1
Checksum: Add support for SHA256 and SHA3
In case, some day, the server also supports it
2020-12-15 10:58:05 +01:00
Olivier Goffart bf6e4174c8
Move the checksum related routine from FileSystem to checksum, where they belong 2020-12-15 10:58:05 +01:00
Olivier Goffart c3f745fa76
Conflict handling: add the OC-ConflictBasePath header
Issue #6702
2020-12-15 10:58:04 +01:00
Christian Kamm be0fa72fcb
RemotePermissions: Fix empty vs null
Fixes two bugs that appeared since the introduction of the struct:
- when reading permissions from the journal, null ("") was read as
  empty-not-null
- when reading permissinos from the server, empty ("") was read as null

Addresses #4608
2020-12-15 10:58:03 +01:00
Olivier Goffart 7e36cc3fcb
New disco algorithm: Fix some moving
Fix TestSyncMove::testSelectiveSyncMovedFolder
2020-12-15 10:57:58 +01:00
Olivier Goffart 4ee244190b
Virtual Files: Allow to download a folder recursively from the socket API
Issue: #6466
2020-12-15 10:57:54 +01:00
Olivier Goffart 09cacc4cd4
Blacklist: remember the X-Request-ID
Issue #6420
Store the X-Request-ID in the SyncFileItem and also in the blacklist.
Note that for consistency reason, the X-Request-ID is also in the
SyncFileItem if the request succeeds.

Currently there is no UI to access it, but it can be queried with sql
commands
2020-12-15 10:57:53 +01:00
allexzander 29ca1404cc Fix Windows compilation broken after QML debugging fix.
Signed-off-by: allexzander <blackslayer4@gmail.com>
2020-11-24 16:50:16 +02:00
allexzander 92733e9069 Fix QML debugging by removing incorrect dependency
Signed-off-by: allexzander <blackslayer4@gmail.com>
2020-11-24 15:19:17 +02:00
Kevin Ottens 0b731eb516 Revert "moved default db sync file to Qt standard path AppDataLocation"
This reverts commit fc6b895f52.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-11-10 17:46:43 +00:00
Sergey Zolotarev 18c1bc0bd6 Misc fixes for Windows 7
Signed-off-by: Sergey Zolotarev <sryze@protonmail.com>
2020-10-28 06:24:53 +00:00
Christian Kamm 00e901f5a7
SocketAPI: Introduce conflict resolution actions #6252
For conflicts generally as well as new files in read-only directories
the context menu will now present delete and move options.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-22 16:40:10 +02:00
renyhp e5b307c81f Update bookmarks location
Signed-off-by: renyhp <renyhp@disroot.org>
2020-10-12 15:02:00 +00:00
Kevin Ottens 836de0358d Add a function for a more friendly user agent string
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-08 05:55:47 +00:00
Jan Schmidt 3077a1378b syncjournaldb: index e2eMangledName column in metadata
Add an index on the e2eMangledName column in the metadata table
to speed up file sync by orders of magnitude on directories with
a large number of files.

Signed-off-by: Jan Schmidt <jan@centricular.com>
2020-09-03 22:56:14 +10:00
Kevin Ottens 80cc196f6f Enable bugprone-narrowing-conversions clang-tidy check
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-09-01 06:37:03 +00:00
Kevin Ottens 5cec1373ad Enable bugprone-macro-parentheses clang-tidy check
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-09-01 06:37:03 +00:00
Kevin Ottens 1a0945a973 Enable all the misc clang-tidy check except one
This flagged mostly unused parameters. Didn't enable the
misc-non-private-member-variables-in-classes check as we got a lot of
those. Hopefully we'll get to fix them at some point but that feels too
early and too much work for now.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-31 09:14:09 +02:00
Camila 71fbc65eb0 Minor fix in text of warning and debug message.
Signed-off-by: Camila <hello@camila.codes>
2020-08-18 14:00:21 +02:00
István Váradi 89d4b6e12a Include cstdint only when compiling C++ code
Signed-off-by: István Váradi <ivaradi@varadiistvan.hu>
2020-08-14 06:15:42 +02:00
Kevin Ottens 0e2af4b502 Enable the modernize-deprecated-headers check on clang-tidy
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-13 14:53:52 +02:00
Kevin Ottens 2f8c29082a Enable the modernize-use-equals-default check on clang-tidy
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-13 14:19:42 +02:00
Kevin Ottens cdf6e7d72b Enable the modernize-user-nullptr check on clang-tidy
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-12 19:45:25 +02:00
Kevin Ottens c50a968a1e
Add more raw string literals missed previously
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-12 09:48:29 +02:00
Kevin Ottens 7bb48a76c4 Add isE2eEncrypted column in the metadata table
This will allow to exploit the information of a directory being
encrypted or not during the discovery phase.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-06 05:27:14 +00:00
Kevin Ottens 9a2d04720a Also use mangled paths when looking for entries below a path
Otherwise on second sync we wouldn't find anything under a mangled path
and just end up thinking said files were removed.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 16:58:29 +00:00
Kevin Ottens 0f21b625ab Also check on mangled names when cleaning up the journal
Otherwise, after a first sync all the mangled entries would be removed
from the journal. On second sync it would be fine because we'd then have
seen the unmangled names because of the local files. Unfortunately
that'd mean reuploading them for nothing or trying to mkdir again on the
server for nothing... with a chance of using differently mangled names
(although I didn't spot it, I can't exclude it never happened).

This also led to weirdly getting stuck during sync when there was more
than one sync point.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 16:58:29 +00:00
Dominique Fuchs f44df7f61a Major multi monitor improvements and rewrite of tray window positioning
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-06-15 12:32:25 +00:00
Michael Schuster 456c1eadbe
Simplify nullptr comparisons where appropriate
Make the codebase consistent, we already have a lot of implicit pointer comparisons.

Exception: Stay explicit on return's, example:
  return _db != nullptr;

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-06-11 00:27:30 +02:00
Rick van der Zwet 24177ec7e4 Change default autostart to hide gui
Signed-off-by: Rick van der Zwet <info@rickvanderzwet.nl>
2020-06-09 18:34:30 +02:00
Stephan Beyer ea16804751 Replace NULL by nullptr in all C++ files
We keep NULL in the pure C files in src/csync/std and test/csync.

We also replace Doxygen documentation referring to "NULL" to
"\c nullptr" (formatted as code).

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-06-08 20:07:50 +02:00
Nicolas Fella bce93b052b Use APPLICATION_ICON_NAME for autostart icon
Signed-off-by: Nicolas Fella <nicolas.fella@gmx.de>
2020-06-08 20:06:00 +02:00
Kevin Ottens e3e262e42e Use default member init when applicable
This also fixes a couple of warnings at places (out of order init for
instance) and a potential bug in the webflow credentials / qtkeychain
integration.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-03 16:10:39 +02:00
Camila San 3bae570f29 Do not declare local variables without an initial value.
Signed-off-by: Camila San <hello@camila.codes>
2020-06-03 07:50:40 +00:00
Kevin Ottens a73a1f3927 Use = default for trivial ctors and dtors
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-05-25 21:33:24 +02:00
Stephan Beyer 04a24c14a8 Use default member initializers in OCC::SyncJournalErrorBlacklistRecord
This allows to remove its explicit default constructor definition.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-05-21 01:41:33 +02:00
Stephan Beyer 3015ea5715 Use default member initializers in OCC::SyncJournalDb sub-structs
This allows to remove their explicit default constructor definitions.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-05-21 01:32:16 +02:00
Kevin Ottens 5543e4d834 Don't use int literals for bools
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-05-20 13:52:58 +02:00
Kevin Ottens 712869db9a Use auto to avoiding repeating type names
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-05-20 03:54:41 +02:00
Kevin Ottens dea6ebaa35 Use nullptr when appropriate
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-05-20 02:21:26 +02:00
Nicolas Fella c1189421c0 Use qEnvironmentVariableIsEmpty
clazy suggests that it is more efficient since it doesn't allocate.

Signed-off-by: Nicolas Fella <nicolas.fella@gmx.de>
2020-03-21 01:06:15 +01:00
Dominique Fuchs dac1c9b413 Avatar, full user name and server address now reflected in QML gui, provided by C++ backend
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-12-03 07:26:59 +01:00
Dominique Fuchs 478281d853 Restructures and refactorings: New systray class, handling of current user selection, integration of user information in tray window header 2019-12-02 22:45:14 +01:00
Michael Schuster 8e8858178b
Merge branch 'master' into move-rtfiles 2019-10-27 17:49:22 +01:00
Michael Schuster 9618500975
fix tab spacing
Signed-off-by: Michael Schuster <michael@schuster.ms>
2019-10-27 17:25:50 +01:00
Dominique Fuchs 3ad1c0e7a8 Created wrapper variable LINUX_APPLICATION_ID to clean up code
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-09-30 09:45:41 +02:00
Dominique Fuchs 83918619cf Corrected new .desktop file location in forgotten function
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-09-26 20:56:14 +02:00
Dominique Fuchs fc6b895f52 moved default db sync file to Qt standard path AppDataLocation
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-09-26 17:09:24 +02:00
Dominique Fuchs 96da4674f9 Updated .desktop file naming scheme
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-09-26 12:36:05 +02:00
Dominique Fuchs ab3d0141ec initialize _modtime to prevent undefined usage
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-09-09 19:23:30 +02:00
Dominique Fuchs 7473cdf184 Removed disabling of msvc warning to prevent generating a unknown option for other compilers in turn. Now detect specifically GCC in ifdef
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-09-09 13:46:46 +02:00
Dominique Fuchs c585e81530 Moved macro definition due to timing issues while compiling when relying on header inheritance
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-09-08 19:46:08 +02:00
Dominique Fuchs 222b2d8645 Further testing of cond. include of Qt library > 5.9. Utilized different macro.
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-09-08 19:17:00 +02:00
Dominique Fuchs f41eeaf6ec Fixed another logic error -> logical to bitwise OR for QTLEGACY
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-09-08 18:51:54 +02:00
Dominique Fuchs 48097801e8 Fixed logic error in QTLEGACY macro and added forgottin #if clause for header file
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-09-08 18:42:40 +02:00
Dominique Fuchs dca83aad45 Added macro definition and compile-time condition to support Qt < 5.9
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-09-08 17:33:34 +02:00
Dominique Fuchs be7a524557 Indeed, DWORD is a special snowflake - only when on _WIN32
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-09-08 16:22:08 +02:00
Dominique Fuchs d60a216982 Use existing fct for RegKeyQuery instead of redundant subroutine
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-09-08 13:44:00 +02:00
Dominique Fuchs d6af025a46 Numoerous safe conversions implemented. Added additional Utility::convertSizeToDWORD for windows builds.
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-09-08 11:33:20 +02:00
Dominique Fuchs 46e0a05078 Renamed conversion function to make intention more clear. Also defaulted to 'controlled truncation' to not stupidly crash. TBD/TODO: Better handling for such things.
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-09-08 02:20:24 +02:00
Dominique Fuchs 8329de4cee Selectively and temporary disabled warning about unknown preprocessor declarative for msvc when using specific GCC instruction.
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-09-08 02:07:52 +02:00
Dominique Fuchs b4dee67bf5 Implemented Utility::convert function to convert size_t -> uint safely and on the fly. Often necessary for Qt and WIN32 functions. Using this will not generate compiler warnings of possible truncation. First call implemented in ownsql.cpp
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-09-08 02:04:50 +02:00
Dominique Fuchs 5ae3435fe6 Fixed broken overloading mechanism of variadic templates. See code comment for further information.
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-09-08 01:09:22 +02:00
Dominique Fuchs 8f3bf3313e Integrated registry check on windows when hasDarkSystray is called.
Return value determines which theme is applied for monochrome variant.
Fixes #1276 but only when monochrome option is toggled or nc starts, not automatically when changing windows theme.

Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-09-01 22:13:14 +02:00
Roeland Jago Douma 326c872ba7
Merge pull request #663 from nextcloud/upstream/pr/6707
Windows: Release handle/fd when file open fails #6699
2018-10-30 22:40:44 +01:00
Roeland Jago Douma 2dc7ff7332
Merge branch 'master' into upstream/pr/6360 2018-10-19 16:13:09 +02:00
Christian Kamm 4bd2545dad
Windows: Release handle/fd when file open fails #6699 2018-09-10 21:17:20 +02:00
Roeland Jago Douma 24efdd3b45
Fix E2E query
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-07-03 11:40:58 +02:00
Roeland Jago Douma 6c11c1aa73
Fix query
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-07-03 10:33:26 +02:00
Olivier Goffart d114212333
OwnSql: Fixup after feedback for #6388 2018-07-03 10:33:26 +02:00
Olivier Goffart 779969f865
OwnSql: Put the SQL queries next to their use.
This avoid haivng to modify 4 places when we want to add a query
2018-07-03 10:33:26 +02:00
Olivier Goffart 518fb90757
OwnSql: Some refactoring
Use QByteArray for the query so we don't have to convert twice.
Automatically finish the query when the DB close, so we don't
have to call reset
2018-07-03 10:33:26 +02:00
Christian Kamm 77fcff5bdf
Conflicts: Change tags to be more user friendly #6365
From "_conflict-user-yyyymmdd-hhmmss"
to   " (conflicted copy user yyyy-mm-dd hhmmss)"
2018-06-11 14:40:40 +02:00
Markus Goetz 3cd21e258e
macOS: Don't use WAL for sqlite3 in /Volumes
For #6049
2018-06-07 10:22:07 +02:00
Christian Kamm 8147963b24
SyncJournal: Explain added file-exists check 2018-06-07 09:50:09 +02:00
Christian Kamm cc04ce9fe4
SyncJournal: Check file existence even for open dbs #6049
With WAL mode sqlite seems to occasionally crash when the
underlying filesystem goes away.
2018-06-07 09:50:09 +02:00
Olivier Goffart 012c638d4e
Uploads: Don't delete unexisting chunks
Since commit 4dc49ff3, we store an entry in the upload info table even
for non chunked uploads. However, if this fails we don't want to remove
non-existant stale chunks if the upload fails.

Without this commit, we would send a DELETE command to clean non-existant
chunks in the dav/uploads/ namespace.
2018-06-06 09:52:02 +02:00
Christian Kamm 09f83f4fa9
SyncJournal: Clear etag filter before sync
Before, we only cleared the _avoidReadFromDbOnNextSyncFilter *after* a
sync which meant that we had to sync twice after selective sync setup.

Now, we clear the filter *before* a sync as well which allows the actual
next sync to write the correct etags to the db again - instead of only
the sync after that one.

Also expand on comments and rename _avoidReadFromDbOnNextSyncFilter to
_etagStorageFilter.
2018-06-05 12:00:20 +02:00
Olivier Goffart 613fd30021
SyncJournalDb::setSelectiveSyncList: Always use a transaction
Issue #6431
2018-06-05 11:15:51 +02:00
Roeland Jago Douma 86741de622
Merge pull request #299 from nextcloud/upstream/pr/6349
Don't delete contents behind directory junctions #6322
2018-05-30 08:03:04 +02:00
Roeland Jago Douma c6c42c3c70
Merge pull request #311 from nextcloud/upstream/pr/6371
Utility::fsCasePreserving: remove UNIT_TESTING ifdef
2018-05-29 20:33:34 +02:00
Roeland Jago Douma b7d5aff901
Merge pull request #303 from nextcloud/upstream/issue/6322
SyncJournal: Don't use LIKE with paths
2018-05-18 13:56:25 +02:00
Roeland Jago Douma 1dc3c156d4
Merge pull request #304 from nextcloud/upstream/pr/6364
Conflicts: Add user name to conflict file name #6325
2018-05-18 13:56:14 +02:00
Olivier Goffart d4aebd30de
Utility::fsCasePreserving: remove UNIT_TESTING ifdef
Since the release package will be build with unit test, we don't
want to query the env variable at every call to fsCasePreserving.
So only test the env variable at startup.
And the testutility can still change the value.

(The env variable is still used from t8.pl and maybe smashbox)

Issue #6318
2018-05-16 12:57:20 +02:00
Christian Kamm 17d174e6fa
Conflicts: Add user name to conflict file name #6325
For the case of uploading conflict files only.
2018-05-15 22:38:35 +02:00
Christian Kamm ce0e2d0b88
SyncJournal: Don't use LIKE with paths
Paths can contain the wildcards % and _ and that would lead to odd
behavior.

This patch also clarifies the behavior of avoidReadFromDbOnNextSync()
which previously dependend on whether "foo/bar" or "foo/bar/" was
passed as input.

Possibly affects #6322
2018-05-15 19:44:00 +02:00
Olivier Goffart 88347a985f
Adjust the Move To Trash patch
(PR #6265)

 - Remove the UI completely
 - Move the #ifdef inside the FileSystem::moveToTrash function, so it is easier to
   implement on other platforms
 - Q_OS_UNIX includes mac, so we need to disable it. (not using Q_OS_LINUX because of
   other BSD that uses XDG spec as well
 - Translate the error messages
 - Add a couple of doc comments
2018-05-15 19:10:41 +02:00
Christian Kamm 2d1d651fcd
Don't delete contents behind directory junctions #6322
QFileInfo::isSymLink() does detect reparse points that are symlinks but
returns false for junctions. The new function FileSystem::isJunction()
can detect those and is used to not recursively delete files inside
directories that are junctions.

See also https://bugreports.qt.io/browse/QTBUG-45344 and the
discussion in the PR https://codereview.qt-project.org/#/c/113019/.
2018-05-15 18:42:44 +02:00
Oleg Solovyov f9fe24feb9
Move remote-deleted files to trash
Squashed from https://github.com/owncloud/client/pull/6265

Linux only, Hidden option, disabled by default
2018-05-15 17:23:38 +02:00
Tomaz Canabrava 7432d6a814 Merge branch 'master' into clientSideEncryptionV4 2018-04-10 16:18:58 +02:00
Daniel Nicoletti d93f7269b8 Properly mark encrypted files for removal 2018-04-09 13:23:52 +02:00
Daniel Nicoletti d3b6aacf3f Fix merging remote and local trees when e2e files are involved
When populating the tree from the filesystem we need to fill
the e2eMangledName from DB and we when trying to find another
match on the oposite tree we need to take in account that names
don't match and search with the mangled name information
2018-04-09 13:23:52 +02:00
Camila San e33d2bf7f7
Removes (s) from time strings.
Signed-off-by: Camila San <hello@camila.codes>
2018-02-25 23:55:04 +01:00
Daniel Nicoletti 99117078f3 Remove table for e2e and add an e2eMangledName column (#169)
If the code was not complex enough syncing two tables
already started to give UNIQUE constrains errors on
simple sync operations, this also adds initial support
remote delete of an encrypted file
2018-02-12 12:50:51 +01:00
Tomaz Canabrava d24a1e542e Merge branch 'master' into clientSideEncryptionV3 2018-01-29 14:06:12 +01:00
Tomaz Canabrava 7b123650da [CSE] Search for name, not mangled name. 2018-01-28 23:48:25 +01:00
Tomaz Canabrava 0c94142c97 [CSE] More debug output 2018-01-28 23:47:58 +01:00
Tomaz Canabrava a003d216a5 [CSE] Implementation of the setE2eRelation
This call creates a new entry on the database for e2e.
2018-01-28 18:05:28 +01:00
Tomaz Canabrava 32eaaa0601 [CSE] GetMangledName implementation 2018-01-28 17:50:10 +01:00
Tomaz Canabrava be817748f8 [CSE] Reset the new Queries on close 2018-01-28 17:46:20 +01:00
Tomaz Canabrava b909bb6977 [CSE] Change the Database to handle Encrypted Files
Create a table to hold the information between the
real file name and the fake file name
2018-01-28 16:41:07 +01:00
Olivier Goffart 776bbbf7b1 Don't include sqlite3.h from headers
So that sqlite is not part of the public interface of csync
(and that the sqlite include path don't need to be passed when compiling
libsync or gui)
2018-01-13 13:58:17 +01:00
Dominik Schmidt dbf15fb8dc Make setLaunchOnStartup debug output more meaningful 2018-01-11 16:11:23 +01:00
Christian Kamm 3988f3ad77 GCC: Fix implicit-fallthrough warnings 2018-01-05 09:43:53 +01:00
Daniel Nicoletti a63d34f870 Prepend "nextcloud" for all logging categories
Thus making easier to exclude logging from kio, qt
and only enable "nextcloud.*"
2017-12-28 17:33:10 -02:00
Christian Kamm a7c0cfc8eb Upload conflict files #4557
If the server has the 'uploadConflictFiles' capability conflict
files will be uploaded instead of ignored.

Uploaded conflict files have the following headers set during upload
  OC-Conflict: 1
  OC-ConflictBaseFileId: 172489174instanceid
  OC-ConflictBaseMtime: 1235789213
  OC-ConflictBaseEtag: myetag
when the data is available. Downloads accept the same headers in return
when downloading a conflict file.

In the absence of server support clients will identify conflict files
through the file name pattern and attempt to deduce the base fileid.
Base etag and mtime can't be deduced though.

The upload job for a new conflict file will be triggered directly from
the job that created the conflict file now. No second sync run is
necessary anymore.

This commit does not yet introduce a 'username' like identifier that
automatically gets added to conflict file filenames (to name the files
foo_conflict-Fred-1345.txt instead of just foo_conflict-1345.txt).
2017-12-15 18:03:53 +01:00
Christian Kamm 8eebc53728 Unify item type enum
Previously, there was csync_ftw_type_e and SyncFileItem::Type. Having
two enums lead to a bug where Type::Unknown == Type::File that went
unnoticed for a good while.

This patch keeps only a single enum.
2017-12-15 18:02:04 +01:00
Olivier Goffart 4dc49ff3b0 SyncEngine: Recover when the PUT reply (or chunkin's MOVE) is lost
This can happen if the upload of a file is finished, but we just got
disconnected right before recieving the reply containing the etag.
So nothing was save din the DB, and we are not sure if the server
recieved the file properly or not. Further local update of the file
will cause a conflict.

In order to fix this, store the checksum of the uploading file in
the uploadinfo table of the local db (even if there is no chunking
involved).  And when we have a conflict, check that it is not because
of this situation by checking the entry in the uploadinfo table.

Issue #5106
2017-12-14 11:56:12 +01:00
Christian Kamm e5ed8fc90a Merge remote-tracking branch 'origin/2.4' 2017-12-13 11:03:24 +01:00
Christian Kamm dcf0baa9de Journal: 64bit inodes, fix storing uint64s generally
In addition to using the right function when retrieving inodes this
*also* fixes a more general bug ownsql had with storing uint64 values
that didn't fit into an int64.
2017-12-12 10:30:54 +01:00
Olivier Goffart 1a503d54f6 Remove usage of deprecated qSort 2017-12-08 16:15:47 +01:00
Olivier Goffart 263668b1cb Remove use of deprecated translate call 2017-12-08 16:15:38 +01:00
Olivier Goffart 3df65460f5 Remove usage of QString::null
Replaces by "QString()"
2017-12-08 16:15:22 +01:00
Olivier Goffart 74672d493d Utility: use QUrlQuery
For QUrl::setQuery is deprecated in Qt5
2017-12-08 16:15:17 +01:00
Olivier Goffart ed5385faa3 Merge remote-tracking branch 'origin/2.4'
Conflicts:
	src/libsync/connectionvalidator.cpp
     	src/libsync/networkjobs.cpp
2017-12-05 15:58:13 +01:00
Markus Goetz 6276d9290d utility_mac: Check for NULL from LSSharedFileListItemResolve #6123
Possibly also #6074
2017-11-28 13:35:15 +01:00
Christian Kamm aafe7c4732 Merge remote-tracking branch 'origin/2.4' 2017-11-20 11:54:56 +01:00
Olivier Goffart 480932a58a Checksum: Ignore unkown OC-Checksum header when downloading...
And if there are several checksums, pick the "best" one.

The case of several checksum was reported in
https://github.com/nextcloud/client_theming/issues/213
2017-11-20 10:51:15 +01:00
Christian Kamm 820ebf4b6e Sql: db close() failing isn't fatal
The assert was made fatal when looking at asserts for #5429 #5518
without having a particular problem in mind. Recent reports weakly
suggest that this might lead to occasional crashes for users when
sqlite_close fails in ways that look ignorable.
2017-11-14 12:10:19 +01:00
Christian Kamm 3608114ec1 Journal: Fix low-disk space errors
Fixes a regression from 4dbe9d4113,
low disk space can lead to IOERR not just CANTOPEN.
2017-11-03 10:44:47 +01:00
Christian Kamm 4dbe9d4113 Journal: Don't crash if the db file is readonly #6050
Surprisingly sqlite3_open_v2() returns ok on readonly files with
SQLITE_OPEN_READWRITE. Probably due to the journal mode?
2017-11-02 16:36:51 +01:00
Christian Kamm 05c1bfb6cf Merge remote-tracking branch 'origin/2.4' 2017-10-27 10:29:31 +02:00
Jocelyn Turcotte 56e38e6f80 Windows: Add sync folders to Explorer's navigation pane
This is only the navigation pane, the SyncRootManager entries aren't handled yet.

This follows the instructions from:
https://msdn.microsoft.com/en-us/library/windows/desktop/dn889934%28v=vs.85%29.aspx

Issue #5295
2017-10-24 16:10:53 +02:00
Christian Kamm 9c7ee6ef85 Reconcile: Rename handling fixes: duplicate file ids
When users share the same tree several times (say A/ and A/B/ are both
shared) the remote tree can have several entries that have the same
file id. This needs to be respected in rename detection.

Also adds several tests and fixes for issues noticed during testing.

See #6096
2017-10-24 10:54:23 +02:00
Christian Kamm e85a339d94 Local discovery: Use db instead of filesystem
We mostly trust the file watchers meaning that we don't re-scan the
local tree if we have done that recently and no file watcher events
have arrived. If the file watchers invalidate a subtree, we rescan
only that subtree.

Since we're not entirely sure the file watchers are reliable, we still
do full local discoveries regularly (1h by default). There is a config
file setting as well as an environment variable to control the interval.
2017-10-24 10:00:20 +02:00
Olivier Goffart a9761a8976 Use qEnvironmentVariable* instead of qgetenv when appropriate
Now that we use Qt5, we should do that. It is slightly more efficient
and declares the intent.
(Modified using clazy)
2017-10-19 13:57:49 +02:00
Markus Goetz d339b68715 Checksums: Use addData function
Our implementation had bad error handling.
This one now uses a new Qt5 addData function.

owncloud/enterprise#2252
2017-10-17 13:26:54 +02:00
Christian Kamm 3f7b3ca962 Checksums: Improve logging and add global disable #5017 2017-10-13 13:08:20 +02:00
Jürgen Weigert 28fe903aee support old sqlite before 3.7.7
quickfix: define the symbol for backwards compat
or FIXME: better solution #ifdef SQLITE_IOERR_SHMMAP where needed...
2017-09-28 19:01:55 +02:00
Olivier Goffart 13e0cc6b50 Use QDateTime::currentDateTimeUtc instead of the non utc version
QDateTime::currentDateTime is terribly slow.
2017-09-26 16:14:17 +02:00
Olivier Goffart 278129b286 OwnSQL: don't parse the error message when we are done 2017-09-26 11:03:23 +02:00
Jocelyn Turcotte 54c522c861 SyncJournalDb: Reimplement the db_is_empty logic from csync
This reduces the initial sync local discovery time from
2.0 to 0.6 seconds in LargeSyncBench on my machine.
2017-09-26 11:03:23 +02:00
Jocelyn Turcotte a034ee894c Use SyncJournalDb in csync
This gets rid of the csync_statedb sqlite layer and use
the same code and same connection as the rest of the SyncEngine.

Missing functions are added to SyncJournalDb and change a few minor
things (like changing SyncJournalFileRecord::_modtime to be an int64
instead of a QDateTime, like it was in csync).
2017-09-26 11:03:23 +02:00
Jocelyn Turcotte 6f46764daa SyncJournalDB: Allow callers of getFileRecord if the query failed
The current implementation would return the same value whether the query failed
or if no row would be found. This is something that is currently checked by csync
and needs to be provided if we want to use SyncJournalDB there.

Adjusted all call sites to also check the return value even though they
could still just rely on rec.isValid(), but makes it more explicit as to what
happens for database errors in those cases, if we ever want to gracefully handle
them.
2017-09-26 11:03:23 +02:00
Jocelyn Turcotte e1d482ea7c SyncJournalDB: Bind phash as a qlonglong instead of a QString
This is what csync does and we don't need to pass it as a string
to let sqlite convert it back to a uint64 later.
2017-09-26 11:03:23 +02:00
Olivier Goffart 95d23b1914 RemotePermissions: Store in a class rather than in a QByteArray to save memory
Create a specific type that parses the permissions so we can store
it in a short rather than in a QByteArray

Note: in RemotePermissions::toString, we make sure the string is not
empty by adding a space, this was already existing before commit
e8f7adc7ca where it was removed by mistake.
2017-09-22 09:29:08 +02:00
Olivier Goffart ff4213b59f Use the Qt5 connection syntax (automated with clazy)
This is motivated by the fact that QMetaObject::noralizeSignature takes 7.35%
CPU of the LargeSyncBench. (Mostly from ABstractNetworkJob::setupConnections and
PropagateUploadFileV1::startNextChunk). It could be fixed by using normalized
signature in the connection statement, but i tought it was a good oportunity
to modernize the code.

This commit only contains calls that were automatically converted with clazy.
2017-09-21 14:05:39 +02:00
Christian Kamm 30843cd368 Fix compile with bad strrchr signature 2017-09-19 12:44:59 +02:00
Christian Kamm 53195b064a Conflicts: Upload them files if env variable says so
Set OWNCLOUD_UPLOAD_CONFLICT_FILES=1 to trigger this behavior.

Note that this is experimental and unsupported. The real feature is
likely to end up in 2.5.

Uploading conflict files is simply done by removing the pattern from
csync_exclude. The rest here deals with making the conflict notification
ui approximately work.

There are still some concerns about where an uploaded conflict file
appears in the sync protocol and issues list (it should be in both, but
is only in one of them currently!).

See #4557.
2017-09-19 11:45:38 +02:00
Christian Kamm dca2664707 Private links: Retrieve link through propfind property #6020
* The sharing ui does a propfind anyway: use that to query the new
property as well!
* For the socket api, asynchronously query the server for the right url
when an action that needs it is triggered.

The old, manually generated URL will be used as fallback in case the
server doesn't support the new property or the property can't be
retrieved for some reason.

Depends on owncloud/core#29021
2017-09-19 10:51:03 +02:00
Jocelyn Turcotte 5e332983e2 SyncJournalDB: Only reset_and_clear_bindings once
We only need to do it once between each query execution and
that can be right before the first bind.
2017-09-18 14:00:52 +02:00
Jocelyn Turcotte a1f1775d15 Move SyncJournalDB to src/common 2017-09-18 14:00:52 +02:00
Jocelyn Turcotte bd25225045 Move non-csync-dependent parts of FileSystem to src/common
This keep the csync-dependent parts in src/libsync, slitting the namespace
over two files.
This will allow moving SyncJournalDB to src/common as well.
2017-09-18 14:00:52 +02:00
Helmut K. C. Tessarek 709aa27031 remove qt4 code 2017-09-15 07:11:05 +02:00
Jocelyn Turcotte 2d7a4bdb06 Windows: Make sure that the folder and Desktop.ini have the right attributes (#6018)
When created from scratch, the owncloud icon won't be picked-up by
explorer unless the right attributes are set on both the sync root and the
Desktop.ini file.

Issue #2446
2017-09-11 15:32:42 +02:00
Jocelyn Turcotte e8f7adc7ca Replace csync_vio_file_stat_t with csync_file_stat_t
Also move csync_normalize_etag to common/utility since we
don't need the char* function anymore.

Remove the single space file_stat->remotePerm codepath since
this won't be used in csync anymore since
8de3bda0b1.

Issue #1817
2017-09-06 13:08:23 +02:00
Jocelyn Turcotte cf15cbf0b3 Move Utility to a new common static library
Now that csync builds as C++, this will avoid having to implement
functionalities needed by csync mandatorily in csync itself.

This library is built as part of libocsync and symbols exported
through it.
This requires a relicense of Utility as LGPL. All classes moved into
this library from src/libsync will need to be relicensed as well.
2017-09-05 17:25:19 +02:00