Commit Graph
100 Commits
Author SHA1 Message Date
Olivier GoffartandKevin Ottens 317d3735d7 SocketAPI: fix status after a failure to move
Issue #7759
2020-12-15 10:59:09 +01:00
Olivier GoffartandKevin Ottens b7193e6a0e Folder Wizard: warn when adding a folder which is the parent of a sync'ed folder
issue #7741
2020-12-15 10:59:07 +01:00
Olivier GoffartandKevin Ottens a6a0e361c1 fixup test 2020-12-15 10:59:07 +01:00
Olivier GoffartandKevin Ottens 9f2c67dca9 Tests: add a couple of move tests
This was an attempt to reproduce #7722, but this actually does not
reproduce it
2020-12-15 10:59:07 +01:00
Olivier GoffartandKevin Ottens 7fd4a280f0 Make PluginFactory virtual to silent -Wnon-virtual-dtor warning
This is not necessary, but it also shouldn't hurt.
2020-12-15 10:59:06 +01:00
Olivier GoffartandKevin Ottens 1c10fceacc SyncEngine: no need to use QAtomicInt
This was done because the propagator jobs where running in a thread a long
time ago, but this is no longer the case.

(Also QAtomicInt::load is marked as deprecated now)
2020-12-15 10:59:05 +01:00
Olivier GoffartandKevin Ottens f81f96915f ProxyAuthHandler Use QPointer instead of QWeakPointer
QWeakPointer::data is deprecated.
In this case we should use QPointer
2020-12-15 10:59:05 +01:00
Olivier GoffartandKevin Ottens 0e7c56e81c Don't show the "All files deleted" popup when unselecting everything with selective sync
Issue #7337
2020-12-15 10:59:04 +01:00
Olivier GoffartandKevin Ottens 4424eb7f07 AccountSettings: limit the clickable region of the 'add folder' button
Issue #7326
2020-12-15 10:59:03 +01:00
Olivier GoffartandKevin Ottens b97c0ed8a2 Network Settings: Show a warning that proxy settings do not apply to localhost
Only show this if at least one account is detected to have an url that looks
like localhost, because this could otherwise be confusing

Issue #7169
2020-12-15 10:59:03 +01:00
Olivier GoffartandKevin Ottens 392d3c257c Discovery: Allow more HTTP error code to be treated as ignored dir
The original code from csync was stopping at any error.
But we have been whitelisting soeme http error code one by one
to ignore the directory instead of aborting the sync.
However, as there are more requests to continue the sync in case
of error, just ignore most HTTP errors

Issue #7586
2020-12-15 10:59:03 +01:00
Olivier GoffartandKevin Ottens 66f7b27121 VFS: Do not overwrite existing files by placeholder
For issue #7557 and #7556

Note: this change the API of the VFS plugin, so the VFS plugin needs small
adaptations
2020-12-15 10:59:03 +01:00
Olivier GoffartandKevin Ottens fc0aeb53b1 Discovery: fix TestSyncVirtualFiles::testExtraFilesLocalDehydrated on windows
On windows we do a test to know if we should change the case of the files,
but that conflict with the test that checks if the file was still there
when the filename is actually the same. Which can happen with virtual files
as they have two representation (the one with and without suffix).
2020-12-15 10:59:02 +01:00
Olivier GoffartandKevin Ottens ca18bbc2ca Test: Fix testsyncvirtualfiles test
Like previous commit, the failure was caused by two conflicting commits
2020-12-15 10:59:02 +01:00
Olivier GoffartandKevin Ottens ecd3de61f5 Fix build of tests.
Resulted from a conflict between two patches
2020-12-15 10:59:02 +01:00
Olivier GoffartandKevin Ottens 88f86a56b1 Discovery: Attempt to fix issue with windows VFS and new files
(or moved files)
As seen in the log of #7558, a conflict may be issued by mistake.

See investigation in https://github.com/owncloud/client/issues/7558#issuecomment-547385362

This hopefully fix #7558
2020-12-15 10:59:02 +01:00
Olivier GoffartandKevin Ottens 513b0c723c Account Settings: change the color of info message from green to blue
To avoid confusion with the color of "success"

Issue #7403
2020-12-15 10:59:02 +01:00
Olivier GoffartandKevin Ottens 4d7ed8f62c Wizard: fix compilation warnings about unused variables 2020-12-15 10:59:01 +01:00
Olivier GoffartandKevin Ottens 115a53134c SyncEngine: Save a bit of memory by not keeping a set of all filename
This is only used for conflict files, so only save conflict files.
(The _seenFile was used for other things in 2.5, but not anymore)
2020-12-15 10:59:01 +01:00
Olivier GoffartandKevin Ottens 83d743b66b When moving is allowed but deleting is not, do not restore moved items
Issue #7293
2020-12-15 10:59:01 +01:00
Olivier GoffartandKevin Ottens ee611e6004 Restoration items should appear in the sync protocol
When an item is downloaded because it is restored, it shall be shown in the
sync protocol.
(It is also going to be shown in the not synchronized for a short while, but
that's fine)
2020-12-15 10:59:01 +01:00
Olivier GoffartandKevin Ottens cb38bb2b5e Fix Upload of large (> 2GiB) files
Issue #7506

This is a regression introduced by the delta sync feature (as the chunk offset
changed from being the chunk number to be the byte offset, it needs to be a
qint64 now)
2020-12-15 10:59:01 +01:00
Olivier GoffartandKevin Ottens 390af4d41b Tests: introduce ItemCompletedSpy to avoid a bit of code duplication 2020-12-15 10:59:00 +01:00
Olivier GoffartandKevin Ottens adbd3d869b Fix warning about serverJob not being used
And fix a FIXME in the same time
2020-12-15 10:59:00 +01:00
Olivier GoffartandKevin Ottens c335f69a65 Discovery: Do not abort the sync in case of error 404 (or 500)
Issue: #7199
2020-12-15 10:58:51 +01:00
Olivier GoffartandKevin Ottens 9f08636a4a SyncEngine: Fix renaming a single file cause the "delete all file" popup
Possibly a regression, since the new discovery discovers rist the renamed
files as removed

Issue #7204
2020-12-15 10:58:51 +01:00
Olivier GoffartandKevin Ottens 2c975b1e70 SocketAPI: Fix string claiming a folder is a file
Issue #7206
2020-12-15 10:58:51 +01:00
Olivier GoffartandKevin Ottens afbb580528 Test: fix compilation with GCC 4.9
It does not appear to support variadic lambda
2020-12-15 10:58:44 +01:00
Olivier GoffartandKevin Ottens 4346567a03 Async Poll: keep the size in the database
This was not required with 2.5 because a size of 0 was ignorted when comparing
size by the csync updater, to be compatible with very old version of the database.
But the we discovery will still think the file is changed if the database contains
a size of 0
2020-12-15 10:58:44 +01:00
Olivier GoffartandKevin Ottens 46bf3ed31a Upload: asynchronious operations
Implements https://github.com/owncloud/core/pull/31851
2020-12-15 10:58:44 +01:00
Olivier GoffartandKevin Ottens 87bd26bf6c AccountManager: load the cookies
For issue #7054
2020-12-15 10:58:43 +01:00
Olivier GoffartandKevin Ottens 6f4bf585f0 Move: Fix move detection in directory move on the other side 2020-12-15 10:58:35 +01:00
Olivier GoffartandKevin Ottens 88d02a887f Move: add comments and tests 2020-12-15 10:58:35 +01:00
Olivier GoffartandKevin Ottens 1fb4c22adf Move: add more test and fix move within moves 2020-12-15 10:58:35 +01:00
Olivier GoffartandKevin Ottens ade4c11de3 Rename: fix renamed folder moved into renamed folder issue
Issue #6694
2020-12-15 10:58:35 +01:00
Olivier GoffartandKevin Ottens f258af1198 sqlite: Update bundled version to 3.26.0
For OS X and Windows.
2020-12-15 10:58:31 +01:00
Olivier GoffartandKevin Ottens c31d3f277f HttpCredentials: Do not re-enter the event loop
https://sentry.io/owncloud/desktop-win-and-mac/issues/777907931/
mention a crash in OCC::HttpCredentialsGui::showDialog
One possible explaination is that this is caused by re-entring the event loop.
So don't do that.
2020-12-15 10:58:31 +01:00
Olivier GoffartandKevin Ottens 51d2e41d8b Chunking Move: Fix too many starting slashes in the destination header
Commit 6ca724f fixed it for the move case. But the upload MOVE did the same

Issue #6904
2020-12-15 10:58:31 +01:00
Olivier GoffartandKevin Ottens 0e56dfe3a4 Gui: do not show the settings when opening a virtual file
Issue #6764
2020-12-15 10:58:31 +01:00
Olivier GoffartandKevin Ottens 62ec4c9330 Discovery: Handle the blacklistFiles from the server capabilities
Issue #434

Ideally one could add the blacklist to the exlucde reggexp, but this
is simpler
2020-12-15 10:58:30 +01:00
Olivier GoffartandKevin Ottens dfedb09fd8 Move test for issue #1329 from t1.pl to new test system 2020-12-15 10:58:29 +01:00
Olivier GoffartandKevin Ottens a29320b18d Discovery: Set right direction when restoring deleted discovery because it has modified files
(Catched by a faillure of t1.pl)
2020-12-15 10:58:29 +01:00
Olivier GoffartandKevin Ottens 6da96cd026 Port the exclude test to the QTest Framework
This is just a port to QtTest, I did not change the layout of the test.
I did search and replace to replace the assert with QCOMPARE/QVERIFY
I still call setup and setup_init like before (only explicitly, now)

Also ported the preformence tests to QBENCHMAK because windows don't have
gettimeofday.

Relates #6358
2020-12-15 10:58:29 +01:00
Olivier GoffartandKevin Ottens fad1238b33 Test: Move the test for Utility::normalizeEtag to testutility.cpp
I just moved the text and did the minimum to port it to QtTest
Did not change hte layout of it.

Relates #6358
2020-12-15 10:58:28 +01:00
Olivier GoffartandKevin Ottens 6e048a2d3f Remove check_csync_util
It's testing nothing.
Only that one can convert a csync instruction to a string.
But this is only used in debug anyway

Relates to #6358
2020-12-15 10:58:28 +01:00
Olivier GoffartandKevin Ottens fd410a5a84 SyncEngine: Ensure that the paths passed to the discovery ends with slashes
This was making the tx.pl test fail
2020-12-15 10:58:28 +01:00
Olivier GoffartandKevin Ottens edd806960d Propagator: Don't abort sync on error 503
Only do it when it is actually a maintenance mode

Issues #5088, #5859, https://github.com/owncloud/enterprise/issues/2637
2020-12-15 10:58:27 +01:00
Olivier GoffartandKevin Ottens feb770eca7 Allow to open log window via command line to already running client
Issue: #4098
2020-12-15 10:58:27 +01:00
Olivier GoffartandKevin Ottens a7a54b6d11 VFS: Plugin needs to be installed, otherwise it can't be loaded 2020-12-15 10:58:27 +01:00
Olivier GoffartandKevin Ottens 47b2913357 Fix compilation warning
src/libsync/propagatorjobs.cpp:63:10: warning: lambda capture 'this' is not used [-Wunused-lambda-capture]
        [this, &deleted](const QString &path, bool isDir) {
         ^~~~~
2020-12-15 10:58:27 +01:00
Olivier GoffartandKevin Ottens a6614c18f1 IgnoreListEditor: increase a bit the size
Should Help for issue #6641
2020-12-15 10:58:21 +01:00
Olivier GoffartandKevin Ottens 7c1871ae65 Account: Fix crash when deleting an account
We should not have request parented to the account, otherwise we might get
a loop on the deletion order.

Issue #6893
2020-12-15 10:58:21 +01:00
Olivier GoffartandKevin Ottens 175b064364 cjhash: use Q_FALLTHROUGH
This fixes the warning
   warning: unknown option after ‘#pragma GCC diagnostic’ kind [-Wpragmas]

Issue #6872
2020-12-15 10:58:20 +01:00
Olivier GoffartandKevin Ottens 1c443ad021 CMakeLists.txt: increment sqlite version
3.9 is required for custom index to work
2020-12-15 10:58:20 +01:00
Olivier GoffartandKevin Ottens 5e05b61d2f csync_vio_locale: use QString for the path in opendir
So we don't have to convert to utf8 and back again
2020-12-15 10:58:20 +01:00
Olivier GoffartandKevin Ottens f0c24cb6f9 Remove csync_misc: The code no longer use fnmatch 2020-12-15 10:58:20 +01:00
Olivier GoffartandKevin Ottens 3c3619f99a Exclude: do everything with QString wiuthout converting to char* 2020-12-15 10:58:19 +01:00
Olivier GoffartandKevin Ottens 164051b0c9 ProcessDirectoryJob::process: optimize so there is only one map 2020-12-15 10:58:19 +01:00
Olivier GoffartandKevin Ottens 1783db5811 PropagateUpload: Avoid many allocations by using QByteArrayLiteral 2020-12-15 10:58:19 +01:00
Olivier GoffartandKevin Ottens d6a0290058 Optimisation: Add a cache SyncJournalDb::mapChecksumType
No need to do two sql query for something that's always the same and
there are very few checksum types
2020-12-15 10:58:19 +01:00
Olivier GoffartandKevin Ottens 69de2d5180 Sync: optimize by removing setFileRecordMetadata
Inh most case we already have a record from before, so avoid doing a useless
lookup in the database.
In owncloudpropagator.cpp, directories do not have a checksum so no need
to call a function that preserves it
2020-12-15 10:58:19 +01:00
Olivier GoffartandKevin Ottens 416a0b3482 Test System: Optimisations so the benchmark is significant 2020-12-15 10:58:19 +01:00
Olivier GoffartandKevin Ottens 7e1840bb2f OwnSql: Speedup by avoiding allocating an error string on success 2020-12-15 10:58:18 +01:00
Olivier GoffartandKevin Ottens bb9ce8db21 Test that the sync behave well if there are errors while reading the database 2020-12-15 10:58:17 +01:00
Olivier GoffartandKevin Ottens b79e57d1c1 Discovery: fix double emission of finished in case of error 2020-12-15 10:58:17 +01:00
Olivier GoffartandKevin Ottens 7061f31887 Discovery: Fix downloading files when database is used for local discovery
This also fix the currently failling LockedFilesTest
2020-12-15 10:58:17 +01:00
Olivier GoffartandKevin Ottens 0eaa950e9e Remove csync.cpp: It's only dead code 2020-12-15 10:58:17 +01:00
Olivier GoffartandKevin Ottens 2c9b66fe69 RemoteDiscoveryTest: Fix after the merge from 2.5
The new discovery's message is slightly different
2020-12-15 10:58:16 +01:00
Olivier GoffartandKevin Ottens eb23776f16 Discovery: Fix renaming on windows
buf.type is ItemFileSkip because csync_vio_local_stat does not set this field
2020-12-15 10:58:16 +01:00
Olivier GoffartandKevin Ottens beee123c80 New Discovery: Fix trailing slash causing failure on windows 2020-12-15 10:58:16 +01:00
Olivier GoffartandKevin Ottens 60b17cd128 Folder: update the folder version
Since the new index would crash old version of the client, we need to
upgrade folder version so they do not load in the client 2.5.0
2020-12-15 10:58:15 +01:00
Olivier GoffartandKevin Ottens ab85c60205 owncloudcmd: Read the server version from the capabilities
Issue: #6846
2020-12-15 10:58:15 +01:00
Olivier GoffartandKevin Ottens 3e4486c078 owncloudcmd: fetch the dav user
This is required to get the new endpoint working when the server
uses ldap or that the dav user is not the same as the login.

Issue #6830
2020-12-15 10:58:15 +01:00
Olivier GoffartandKevin Ottens ec8c02dad0 Sharing: add the shareWithAdditionalInfo string in autocompletion results
Issue #6749
2020-12-15 10:58:15 +01:00
Olivier GoffartandKevin Ottens e20e1d110f Move: Fix too many starting slashes in the destination header
QDir::cleanPath does not remove starting slashes on windows.
So use account::davUrl which is already cleaned

Issue: #6824
2020-12-15 10:58:15 +01:00
Olivier GoffartandKevin Ottens dcfbde2a67 Wizard: Reset the QSslConfiguration before checking the server
Because a previous call with another demain might have set some
config for another server.

Issue #6832
2020-12-15 10:58:14 +01:00
Olivier GoffartandKevin Ottens b820e46805 Fix compiler warning 2020-12-15 10:58:14 +01:00
Olivier GoffartandKevin Ottens 35967fc2d6 OAuth2: Refresh the token without aborting the sync
OAuth2 access token typically only has a token valid for 1 hour.
Before this patch, when the token was timing out during the sync, the
sync was aborted, and the ConnectionValidator was then requesting a new
token, so the sync can be started over.
If the discovery takes longer than the oauth2 validity, this means that
the sync can never proceed, as it would be always restarted from scratch.

With this patch, we try to transparently renew the OAuth2 token and restart
the jobs that failed because the access token was invalid.

Note that some changes were required in the GETFile job because it handled
the error itself and so it was erroring the jobs before its too late.

Issue #6814
2020-12-15 10:58:14 +01:00
Olivier GoffartandKevin Ottens 53a14c2041 HttpCredentials: initialize all member inline 2020-12-15 10:58:14 +01:00
Olivier GoffartandKevin Ottens 58eaf9940a Database: Add an index on the parent path
So we can quickly query the items in a parent directory

This uses a custom slite3 function, which means that when downgrading the client,
or using another tool to add entries in the database, any insertion in the metadata
table will produce an error: "unknown function: parent_hash()"
(This will crash the client 2.5)
2020-12-15 10:58:13 +01:00
Olivier GoffartandKevin Ottens e45e57982d Add missing export 2020-12-15 10:58:13 +01:00
Olivier GoffartandKevin Ottens a4e139969c Fix windows build 2020-12-15 10:58:12 +01:00
Olivier GoffartandKevin Ottens 8490664860 Account Settings: fix progress being written in white when there are errors 2020-12-15 10:58:12 +01:00
Olivier GoffartandKevin Ottens 94e63ef7b9 Account Settings: Add a context menu entry to enable or disable virtual files
Issue #6725
2020-12-15 10:58:12 +01:00
Olivier GoffartandKevin Ottens 18f6e346b8 Upload: Do not error out if the server do not send the X-OC-MTime: accepted header
If the server does not set the mtime, it is not a big problem for the
synchronisation.

The test was used before so we could do a PROPPATCH for server that did not
support this header. But now that all server supports that we don't need to
to the check. (We do not do the PROPPATCH since we got rid of the neon
dependency)

Apparently, it may happen that some backend don't support setting mtime
and this can lead to this error.

https://github.com/owncloud/client/issues/6797
2020-12-15 10:58:11 +01:00
Olivier GoffartandKevin Ottens 15eab07866 OAuth2: Store 'Account::davUser' in the config, and use that user for connecting
We need to use the user id to check if we are connected to the right account.
These might be different from the HTTP Basic Auth login. (LDAP setups)

When the account was configured as an oauth2 account form the wisard, the
http_user was already set correctly to the user id. But when the server is
upgrading from basic auth to oauth2, we need to pick the right login.

Note that Account::davUser() already defaults to the HTTP user when none
is set, so this means the upgrade will be fine if this is not set in the
config.

Issues:
https://github.com/owncloud/oauth2/issues/109
https://github.com/owncloud/enterprise/issues/2781
2020-12-15 10:58:11 +01:00
Olivier GoffartandKevin Ottens 75f66ddaa1 Local discovery: always recurse within touched directory
If the file system watcher tells us a directory was modified, we should
recurse into it because it means it is probably a new directory

Issue #6804
2020-12-15 10:58:11 +01:00
Olivier GoffartandKevin Ottens 640cf0c71e Fix leaks in tests
As discovered by AddressSanitizer
2020-12-15 10:58:11 +01:00
Olivier GoffartandKevin Ottens 5a1c93d0ac Discovery: make sure finished is not called twice, even in case of errors 2020-12-15 10:58:10 +01:00
Olivier GoffartandKevin Ottens b86e1efc9a Remove the backup deteciton code which was used for server < 9.1 2020-12-15 10:58:10 +01:00
Olivier GoffartandKevin Ottens f666511a4b Discovery: Remove stale DB entries
And test the Remove/Remove case.

This means we need to always query the database for all the entries.
This showed another small bug in the test in which sync item for virtual
files at the root could have a slash in front of them.
2020-12-15 10:58:10 +01:00
Olivier GoffartandKevin Ottens aa18e10ff5 Discovery: cleanups and comments 2020-12-15 10:58:09 +01:00
Olivier GoffartandKevin Ottens b10b3e5eeb Discovery: move checkMovePermissions to its own function 2020-12-15 10:58:09 +01:00
Olivier GoffartandKevin Ottens edd866b32b Discovery: Adjust the instruction in case of resolved conflict
When resolving a conflict because the file was just updated on the server,
we write all the metadata on the database immediatly, so INSTRUCITON_NONE
is enough and UPDATE_METADATA is not needed
2020-12-15 10:58:09 +01:00
Olivier GoffartandKevin Ottens 7cddaf82ab ProcessDirectoryJob: always set _childModified to true, regardless the direction
This was like that to handle the case of CSYNC_INSTRUCTION_TYPE_CHANGE, but just add
a condition in this location.
2020-12-15 10:58:09 +01:00
Olivier GoffartandKevin Ottens 46510c2f39 Discovery phase: refactor some code in DiscoveryPhase::findAndCancelDeletedJob
Less code duplication
2020-12-15 10:58:09 +01:00
Olivier GoffartandKevin Ottens 1c2a3279bb New Discovery Algorithm: more cleanups
- rename progress() to be more explicit
 - Make some more member of the discovery phase private
2020-12-15 10:58:09 +01:00
Olivier GoffartandKevin Ottens 2f8c77c54f Fixup commit 835c9163374f42003aa2f7795ade3f4ff62c8877
The previous code considered the also HTTP 207 code without the
application/xml header to have this message.
httpCode 0 does not make much sense anyway.

This change the behavior to consider any 2xx without the xml header
to show this error message
2020-12-15 10:58:08 +01:00
Olivier GoffartandKevin Ottens c009dae1ce New discovery algorithm: fixups
Adapt reviews from ckamm in https://github.com/owncloud/client/pull/6738#pullrequestreview-164623532

- SyncJournalFileRecord: initialize everything inline
- Add more comments
- And some ENFORCE
2020-12-15 10:58:08 +01:00
Olivier GoffartandKevin Ottens 059f722b3b Move Result to its own header 2020-12-15 10:58:08 +01:00