nextcloud-desktop.git
5 years agoDiscovery: Parse etag to be consistent with RequestEtagJob
Christian Kamm [Fri, 26 Jul 2019 08:00:19 +0000 (10:00 +0200)]
Discovery: Parse etag to be consistent with RequestEtagJob

This avoids unnecessary sync runs.

For #7345

5 years agoVfs: Require local discovery after disabling vfs
Christian Kamm [Thu, 25 Jul 2019 13:14:51 +0000 (15:14 +0200)]
Vfs: Require local discovery after disabling vfs

Without it local files aren't guaranteed to be downloaded #6936.

5 years agoVfs: Remove old db record when dehydrating via rename
Christian Kamm [Wed, 24 Jul 2019 14:07:28 +0000 (16:07 +0200)]
Vfs: Remove old db record when dehydrating via rename

For #7338

5 years agoVfs: Make move detection work with virtual files #7001
Christian Kamm [Wed, 24 Jul 2019 13:07:20 +0000 (15:07 +0200)]
Vfs: Make move detection work with virtual files #7001

Previously a checksum computation could be done on a suffix-placeholder
file, making discovery believe that no move took place.

5 years agoVfs: Ensure pins change with (de-)hydration
Christian Kamm [Wed, 24 Jul 2019 13:25:02 +0000 (15:25 +0200)]
Vfs: Ensure pins change with (de-)hydration

Previously an implicit hydration of a file in an online-only folder
would not change the pin state and cause a dehydration on the next
sync.

5 years agoVfs: Add hook to allow update-metadata for unchanged files
Christian Kamm [Tue, 23 Jul 2019 12:26:46 +0000 (14:26 +0200)]
Vfs: Add hook to allow update-metadata for unchanged files

Allows winvfs to convert files to placeholders when vfs is enabled. This
is required to mark files as in-sync #7329.

5 years agoVfs: Improve strings for availability states
Christian Kamm [Wed, 17 Jul 2019 13:15:54 +0000 (15:15 +0200)]
Vfs: Improve strings for availability states

5 years agoVfs: Preserve pin state on hydration
Christian Kamm [Thu, 18 Jul 2019 13:30:40 +0000 (15:30 +0200)]
Vfs: Preserve pin state on hydration

For #7322 and #7323

5 years agoVfs: Retain existing data when enabling vfs #7302
Christian Kamm [Wed, 10 Jul 2019 11:34:17 +0000 (13:34 +0200)]
Vfs: Retain existing data when enabling vfs #7302

Previously all local data was deleted because the root folder was marked
as OnlineOnly.

5 years agoAdd missing OWNCLOUDSYNC_EXPORT
Dominik Schmidt [Fri, 28 Jun 2019 15:26:54 +0000 (17:26 +0200)]
Add missing OWNCLOUDSYNC_EXPORT

5 years agoVfs: Make test pass with different suffix #7279
Christian Kamm [Fri, 28 Jun 2019 08:44:13 +0000 (10:44 +0200)]
Vfs: Make test pass with different suffix #7279

5 years agoVfsSuffix: Wipe stale pin states #7273
Christian Kamm [Thu, 27 Jun 2019 13:47:04 +0000 (15:47 +0200)]
VfsSuffix: Wipe stale pin states #7273

Previously the pin states of deleted files stayed in the 'flags'
database and could be inadvertently reused when a new file with the same
name appeared. Now they are deleted.

To make this work right, the meaning of the 'path' column in the 'flags'
table was changed: Previously it never had the .owncloud file suffix.
Now it's the same as in metadata.path.

This takes the safe parts from #7274 for inclusion in 2.6. The more
elaborate database schema changes (why use 'path' the join the two
tables in the first place?) shall go into master.

5 years agoRequestEtagJob: Consistently parse etags #7271
Christian Kamm [Fri, 21 Jun 2019 13:29:42 +0000 (15:29 +0200)]
RequestEtagJob: Consistently parse etags #7271

Previously RequestEtagJob did return the etag verbatim (including extra
quotes) while the db had the parsed form. That caused the etag
comparison during discovery move detection to always fail. The test
didn't catch it because the etags there didn't have quotes.

Now:
- RequestEtagJob will parse the etag, leading to a consistent format
- Tests have etags with quotes, detecting the problem

5 years agoUploadDevice: Fix windows issues #7264
Christian Kamm [Fri, 21 Jun 2019 09:34:59 +0000 (11:34 +0200)]
UploadDevice: Fix windows issues #7264

- Close the UploadDevice to close the QFile after the PUT job is done.
  This allows winvfs to get an oplock on the file later.

- Don't rely on QFile::fileName() to be valid after
  openAndSeekFileSharedRead() was called. The way it is openend on
  Windows makes it have an empty filename.

5 years agoVfs: Move pin state if files move #7250
Christian Kamm [Fri, 21 Jun 2019 07:39:33 +0000 (09:39 +0200)]
Vfs: Move pin state if files move #7250

Previously renames of items didn't carry the pin state with them.

5 years agoVfs: Don't let new local files start out unpinned #7250
Christian Kamm [Fri, 21 Jun 2019 07:06:07 +0000 (09:06 +0200)]
Vfs: Don't let new local files start out unpinned #7250

If one adds a new file to an online-only folder the previous behavior
was to upload the file in one sync and dehydrate it in the next. Now
these new files get set to Unspecified pin state, making them retain
their data.

5 years agoOAuth2: Better error logging
Markus Goetz [Tue, 14 May 2019 12:00:14 +0000 (14:00 +0200)]
OAuth2: Better error logging

This does not fix a bug, just was found while spotting a bug that was no bug.
For https://github.com/owncloud/enterprise/issues/2951

5 years agoUpload: Read file chunks gradually #7226
Christian Kamm [Thu, 6 Jun 2019 10:22:02 +0000 (12:22 +0200)]
Upload: Read file chunks gradually #7226

Instead of all at once, to reduce peak memory use.

Changing UploadDevice in this way requires keeping the file open for the
duration of the upload. It also means changes to open(), seek(), close()
to ensure that uses of the device work right when a request needs to
be resent.

5 years agoHttp2: Resend requests on ContentReSend error #7174
Christian Kamm [Wed, 5 Jun 2019 13:24:57 +0000 (15:24 +0200)]
Http2: Resend requests on ContentReSend error #7174

Since Qt does not yet transparently resend HTTP2 requests in some cases
we do it manually.

The test showed a problem where the initial non-200 reply would close
the target temporary file and the follow-up request couldn't store any
data. Removing that close() call is safe because there also is a
_saveBodyToFile flag that guards writes to the target file.

5 years agoDiscovery: Do not abort the sync in case of error 404 (or 500)
Olivier Goffart [Tue, 4 Jun 2019 14:00:43 +0000 (16:00 +0200)]
Discovery: Do not abort the sync in case of error 404 (or 500)

Issue: #7199

5 years agoSyncEngine: Fix renaming a single file cause the "delete all file" popup
Olivier Goffart [Tue, 4 Jun 2019 10:08:15 +0000 (12:08 +0200)]
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

5 years agoSocketAPI: Fix string claiming a folder is a file
Olivier Goffart [Tue, 4 Jun 2019 10:50:30 +0000 (12:50 +0200)]
SocketAPI: Fix string claiming a folder is a file

Issue #7206

5 years agoLog Window: Create and open folder properly #7166
Markus Goetz [Thu, 23 May 2019 10:50:04 +0000 (12:50 +0200)]
Log Window: Create and open folder properly #7166

5 years agoowncloudcmd: log sync errors
Christian Kamm [Tue, 7 May 2019 12:21:57 +0000 (14:21 +0200)]
owncloudcmd: log sync errors

Previously it was hard to debug some errors since the messages would not
show up in the output.

5 years agoChunked upload: Fix percent encoding in If header #7176
Christian Kamm [Tue, 7 May 2019 06:08:24 +0000 (08:08 +0200)]
Chunked upload: Fix percent encoding in If header #7176

5 years agoTests: Fix DB locking issue in permissions test
Christian Kamm [Tue, 7 May 2019 06:25:49 +0000 (08:25 +0200)]
Tests: Fix DB locking issue in permissions test

5 years agoTests: fix vfs availability test case
Christian Kamm [Tue, 7 May 2019 06:21:46 +0000 (08:21 +0200)]
Tests: fix vfs availability test case

5 years agoVfs: Mark sqlite temporaries excluded on db-open #7141
Christian Kamm [Tue, 23 Apr 2019 11:38:58 +0000 (13:38 +0200)]
Vfs: Mark sqlite temporaries excluded on db-open #7141

The previous patch ensured that the sqlite temporaries weren't deleted
and recreated for every sync run, but there was still time between
client startup and the first sync run where they would have the
"needs-sync" icon.

5 years agoVfs: Distinguish availability error kinds #7143
Christian Kamm [Thu, 25 Apr 2019 09:10:52 +0000 (11:10 +0200)]
Vfs: Distinguish availability error kinds #7143

Previously "no-availability" meant db-error and querying the
availability of a nonexistant path returned AllHydrated.

Now, the availability has a DbError and a NoSuchItem error case.

5 years agoFix logic for duration that an etag reply indicates connectivity
Christian Kamm [Thu, 25 Apr 2019 09:52:41 +0000 (11:52 +0200)]
Fix logic for duration that an etag reply indicates connectivity

This got inverted accidentally when std::chrono was introduced.

For #7160

5 years agoVfs: "free space" only shows when it has an effect #7143
Christian Kamm [Tue, 16 Apr 2019 08:17:21 +0000 (10:17 +0200)]
Vfs: "free space" only shows when it has an effect #7143

To do this, introduce AllDehydrated availability and rename
SomeDehydrated to Mixed - it now guarantees there are also hydrated
items.

5 years agoVfs: Adjust and centralise action text #7143
Christian Kamm [Tue, 16 Apr 2019 07:47:55 +0000 (09:47 +0200)]
Vfs: Adjust and centralise action text #7143

Saying "Currently available locally" sounds more like an indicator than
"Availably locally" does. Centralizing translations avoids consistency
issues between shell context menus and sync folder context menu.

5 years agoFolderWizard: Don't crash when typing invalid drive #7041
Christian Kamm [Thu, 14 Mar 2019 08:12:46 +0000 (09:12 +0100)]
FolderWizard: Don't crash when typing invalid drive #7041

When the user typed "x:" where the drive x didn't exist, the validation
function would loop forever. Now it shows a "path doesn't exist" error.

5 years agoSyncEngine: Don't close db when done #7141
Christian Kamm [Tue, 16 Apr 2019 10:18:50 +0000 (12:18 +0200)]
SyncEngine: Don't close db when done #7141

The db-close operation is likely a leftover from when the SyncEngine
owned its own db connection and serves no purpose anymore.

Closing the db causes the removal of the temporary wal and shm files.
These files are recreated when the db is opened again, which happens
almost immediately.

This is a problem for winvfs because the delete-recreate step wipes the
exclusion state on these files just after the sync is done. That meant
that the db temporaries permanently had a "needs sync" icon marker shown
in the explorer.

Avoiding reopening the db also reduces the number of log messages per
sync.

5 years agoSqlite: Use FULL synchronous mode with non-WAL journal
Christian Kamm [Wed, 23 Jan 2019 08:50:21 +0000 (09:50 +0100)]
Sqlite: Use FULL synchronous mode with non-WAL journal

According to the documentation DELETE+NORMAL isn't safe from corruption
on older file systems.

5 years agoLog: Start logging immediately when "permanent logs" enabled #7146
Christian Kamm [Tue, 16 Apr 2019 07:18:19 +0000 (09:18 +0200)]
Log: Start logging immediately when "permanent logs" enabled #7146

Previously one would need to wait for the next sync run to create the
first log file.

5 years agoMention selective sync when switching on vfs
Christian Kamm [Mon, 15 Apr 2019 08:36:14 +0000 (10:36 +0200)]
Mention selective sync when switching on vfs

5 years agoDiscovery: Improvements to doc comments
Christian Kamm [Fri, 12 Apr 2019 08:43:34 +0000 (10:43 +0200)]
Discovery: Improvements to doc comments

5 years agoDiscovery: Query data-fingerprint on root item
Christian Kamm [Fri, 12 Apr 2019 08:59:24 +0000 (10:59 +0200)]
Discovery: Query data-fingerprint on root item

Previously the property wasn't queried, meaning the fingerprint logic
couldn't get triggered.

5 years agoDiscovery: 403 and 503 on root cause error
Christian Kamm [Wed, 10 Apr 2019 09:07:15 +0000 (11:07 +0200)]
Discovery: 403 and 503 on root cause error

Previously these result codes during remote discovery of the sync root
would not cause an error and the discovery would get stuck.

Also extends RemoteDiscovery tests to check for errors on the root item.

5 years agoPropagateIgnore: Default to NormalError for INSTRUCTION_ERROR
Christian Kamm [Wed, 10 Apr 2019 08:48:03 +0000 (10:48 +0200)]
PropagateIgnore: Default to NormalError for INSTRUCTION_ERROR

Previously if one set the instruction to ERROR while forgetting to set
an error status, it'd propagate as FileIgnored. Now the default is
NormalError for INSTRUCTION_ERROR and FileIgnored for
INSTRUCTION_IGNORE.

5 years agoAbout: Add remark about vfs plugin that's in use #7137
Christian Kamm [Wed, 10 Apr 2019 11:40:43 +0000 (13:40 +0200)]
About: Add remark about vfs plugin that's in use #7137

5 years agoFix windows build
Christian Kamm [Wed, 10 Apr 2019 06:18:49 +0000 (08:18 +0200)]
Fix windows build

5 years agoLogWindow: Remove output, add "go to log folder" button #6475
Christian Kamm [Fri, 15 Mar 2019 11:12:13 +0000 (12:12 +0100)]
LogWindow: Remove output, add "go to log folder" button #6475

5 years agoVfs: Add 'availability', a simplified, user-facing pin state #7111
Christian Kamm [Wed, 3 Apr 2019 08:53:04 +0000 (10:53 +0200)]
Vfs: Add 'availability', a simplified, user-facing pin state #7111

The idea is that the user's question is "is this folder's data available
offline?" and not "does this folder have AlwaysLocal pin state?".
The the answers to the two questions can differ: an always-local
folder can have subitems that are not always-local and are dehydrated.

The new availability enum intends to describe the answer to the user's
actual question and can be derived from pin states. If pin states aren't
stored in the database the way of calculating availability will depend
on the vfs plugin.

5 years agoVfs: Clear up relationship between _type and pin state
Christian Kamm [Wed, 3 Apr 2019 11:32:05 +0000 (13:32 +0200)]
Vfs: Clear up relationship between _type and pin state

The pin state is a per-item attribute that has an effect on _type:
AlwaysLocal dehydrated files will be marked for hydration and OnlineOnly
hydrated files will be marked for dehydration.

Where exactly this effect materializes depends on how the pin states are
stored. If they're stored in the db (suffix) the dbEntry._type is
changed during the discovery.

If the pin state is stored in the filesystem, the localEntry._type must
be adjusted by the plugin's stat callback.

This patch makes pin states behave more consistently between plugins.
Previously with suffix-vfs pin states only had an effect on new remote
files. Now the effect of pinning or unpinning files or directories is as
documented and similar to other plugins.

5 years agoSqlite: Update to 3.27.2
Christian Kamm [Fri, 1 Mar 2019 09:54:37 +0000 (10:54 +0100)]
Sqlite: Update to 3.27.2

5 years agoPropagateDirectory: Set initial dir mtime to server mtime #7119
Christian Kamm [Fri, 29 Mar 2019 09:16:09 +0000 (10:16 +0100)]
PropagateDirectory: Set initial dir mtime to server mtime #7119

It's still not synced in any way later.

5 years agoPropagateDirectory: Remove dead code
Christian Kamm [Fri, 29 Mar 2019 09:14:31 +0000 (10:14 +0100)]
PropagateDirectory: Remove dead code

1. The _firstJob is usually deleted by the time the PropagateDirectory
   finishes. (deleteLater() is called early)
2. The PropagateDirectory::_item and PropagateRemoteMkdir::_item point
   to the same SyncFileItem anyway. This code is a leftover from when
   each job had its own instance.

5 years agoDetect missing server data during discovery #7112
Christian Kamm [Tue, 26 Mar 2019 10:19:42 +0000 (11:19 +0100)]
Detect missing server data during discovery #7112

This has two positive effects:
- We can put the error on the particular file that has missing data
- We can sync all other files

5 years agoVfs: Better handling and more tests for suffix file renames
Christian Kamm [Tue, 2 Apr 2019 09:51:47 +0000 (11:51 +0200)]
Vfs: Better handling and more tests for suffix file renames

Previously removing the vfs suffix of a file always triggered a
conflict. Now it may just cause a file download.

This was done because users expected symmetry in the rename actions and
renaming foo -> foo.owncloud already triggers the "make the file
virtual" action. Now foo.owncloud -> foo triggers the "download the
contents" action.

5 years agoVfs suffix: Require suffix when creating placeholder files
Christian Kamm [Fri, 29 Mar 2019 08:36:45 +0000 (09:36 +0100)]
Vfs suffix: Require suffix when creating placeholder files

5 years agoVfs: Hydrating a virtual is SYNC not NEW #7101
Christian Kamm [Mon, 25 Mar 2019 09:53:13 +0000 (10:53 +0100)]
Vfs: Hydrating a virtual is SYNC not NEW #7101

Previously it'd be NEW(ItemTypeFile), but now it has changed to be
SYNC(ItemTypeVirtualFileDownload) which allows better classification.

5 years agoNotifications: Don't say "downloaded" for new files #7101
Christian Kamm [Mon, 25 Mar 2019 09:52:34 +0000 (10:52 +0100)]
Notifications: Don't say "downloaded" for new files #7101

These files may very well just be new virtual files that were explicitly
*not* downloaded.

5 years agoLocal discovery tracking: On success, also wipe _renameTarget
Christian Kamm [Thu, 28 Mar 2019 08:33:20 +0000 (09:33 +0100)]
Local discovery tracking: On success, also wipe _renameTarget

It's possible that the rename target was in the local discovery list.

5 years agoProtocol, Notifications: Show destination() instead of _file
Christian Kamm [Thu, 28 Mar 2019 08:32:01 +0000 (09:32 +0100)]
Protocol, Notifications: Show destination() instead of _file

destination() now consistently points to the file after the successful
sync operation. _file might be the place the item was moved from.

5 years agoFix and test _file and _renameTarget
Christian Kamm [Thu, 28 Mar 2019 08:10:20 +0000 (09:10 +0100)]
Fix and test _file and _renameTarget

There was a bunch of inconsistency around whether _file was set to
_renameTarget or not. This is now never done, passing on more
information.

5 years agoTest: fix compilation with GCC 4.9
Olivier Goffart [Fri, 22 Mar 2019 15:34:41 +0000 (16:34 +0100)]
Test: fix compilation with GCC 4.9

It does not appear to support variadic lambda

5 years agoVFS: Unbreak behavior for rename+hydrate #7001
Christian Kamm [Thu, 7 Mar 2019 13:35:39 +0000 (14:35 +0100)]
VFS: Unbreak behavior for rename+hydrate #7001

Users can rename a file *and* add/remove the vfs suffix at the same time
leading to very complex sync actions. This patch doesn't add support for
them, but adds tests and makes sure these cases do not cause unintened
behavior.

The rename will be propagated, but the users's hydrate/dehydrate request
will be ignored.

5 years agoAsync Poll: keep the size in the database
Olivier Goffart [Thu, 14 Mar 2019 11:08:47 +0000 (12:08 +0100)]
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

5 years agoUpload: asynchronious operations
Olivier Goffart [Mon, 25 Jun 2018 15:47:52 +0000 (17:47 +0200)]
Upload: asynchronious operations

Implements https://github.com/owncloud/core/pull/31851

5 years agomacOS: Fix vfs suffix plugin paths #7090
Markus Goetz [Fri, 15 Mar 2019 12:56:11 +0000 (13:56 +0100)]
macOS: Fix vfs suffix plugin paths #7090

5 years agoLinux: Add autostart delay to avoid tray issues #6518
Christian Kamm [Wed, 13 Mar 2019 09:47:41 +0000 (10:47 +0100)]
Linux: Add autostart delay to avoid tray issues #6518

It seems that sometimes the tray implementation isn't ready on system
startup. Retrying later seems to not help. Delaying the start of the
client is the workaround that people have reported as effective.

5 years agoSocketApi: Fix owncloud/enterprise#2938
Markus Goetz [Fri, 31 Aug 2018 13:03:33 +0000 (15:03 +0200)]
SocketApi: Fix owncloud/enterprise#2938

5 years agoTray: Try to establish tray after 10s if failed initially #6518
Christian Kamm [Wed, 6 Mar 2019 09:55:45 +0000 (10:55 +0100)]
Tray: Try to establish tray after 10s if failed initially #6518

When owncloud is started during desktop startup the tray may not yet
be running when the client starts. This will make the client attempt
to create a tray icon again after 10 seconds if there's no tray
during initial startup.

5 years agoOwnSql: Distinguish no-data from error #6677
Christian Kamm [Mon, 4 Mar 2019 12:58:38 +0000 (13:58 +0100)]
OwnSql: Distinguish no-data from error #6677

This could fix a problem where the client incorrectly decides to delete
local data.

Previously any sqlite3_step() return value that wasn't SQLITE_ROW would
be interpreted as "there's no more data here". Thus an sqlite error at a
bad time could cause the remote discovery to fail to read an unchanged
subtree from the database. These files would then be deleted locally.

With this change sqlite errors from sqlite3_step are detected and
logged. For the particular case of SyncJournalDb::getFilesBelowPath()
the error will now be propagated and the sync run will fail instead of
performing spurious deletes.

Note that many other database functions still don't distinguish
not-found from error cases. Most of them won't have as severe effects on
affected sync runs though.

5 years agoClient certs: Store pkcs12 in config, password in keychain
Christian Kamm [Tue, 19 Feb 2019 10:38:46 +0000 (11:38 +0100)]
Client certs: Store pkcs12 in config, password in keychain

It still reads and writes the old format too, but all newly stored
client certs will be in the new form.

For #6776 because Windows limits credential data to 512 bytes in older
versions.

5 years agoAdd PLUGINDIR cmake setting and define #7027
Christian Kamm [Thu, 7 Mar 2019 09:58:40 +0000 (10:58 +0100)]
Add PLUGINDIR cmake setting and define #7027

By default, plugins are only searched next to the binary or next to the
other Qt plugins. This optional build variable allows another path to be
configured.

The idea is that on linux the oC packaging probably wants the binary in
something like /opt/owncloud/bin and the plugins in
/opt/owncloud/lib/plugins.

Similarly, distribution packagers probably don't want the plugins next
to the binary or next to the other Qt plugins. This flag allows them to
configure another path that the executable will look in.

5 years agoAccountManager: load the cookies
Olivier Goffart [Fri, 1 Mar 2019 07:46:33 +0000 (08:46 +0100)]
AccountManager: load the cookies

For issue #7054

5 years agoWindows: Forbid chars 0-31 in filenames #6987
Christian Kamm [Fri, 1 Mar 2019 08:33:55 +0000 (09:33 +0100)]
Windows: Forbid chars 0-31 in filenames #6987

5 years agoSelective sync: Don't collapse tree when entering mode #7055
Christian Kamm [Thu, 28 Feb 2019 07:15:46 +0000 (08:15 +0100)]
Selective sync: Don't collapse tree when entering mode #7055

doExpand() is called when the selective sync editing mode is enabled in
the folder settings view. Previously it'd set the expansion to be
exactly the root items. Now, it just expands any root items that are
currently collapsed, leaving all other item expansion unchanged.

5 years agoSocketApi: Fix crash with readyRead() after disconnected() #7044
Christian Kamm [Mon, 18 Feb 2019 09:53:41 +0000 (10:53 +0100)]
SocketApi: Fix crash with readyRead() after disconnected() #7044

With the recent bugfix to avoid sending messages on dead connections
0bfe7ac250c54f5415c0a794c7b271428e83c3cf
the client now crashed if readyRead() was received after disconnected()
for the socket as the listener for that connection was already removed.

This code fixes it by still invoking the handler from readyRead() but
passing a SocketListener that won't attempt to send messages.

5 years agoWizard: Avoid cert dialog multiple connection
Christian Kamm [Mon, 18 Feb 2019 13:02:14 +0000 (14:02 +0100)]
Wizard: Avoid cert dialog multiple connection

This could lead to odd behavior when slotCertificateAccepted
was called multiple times.

5 years agoFolder wizard: Fix infinite loop for bad paths #7041
Christian Kamm [Mon, 18 Feb 2019 13:32:47 +0000 (14:32 +0100)]
Folder wizard: Fix infinite loop for bad paths #7041

5 years agoDiscovery win: Fix detection of case-only renames
Christian Kamm [Thu, 14 Feb 2019 13:52:22 +0000 (14:52 +0100)]
Discovery win: Fix detection of case-only renames

Previously they were detected as DELETE+NEW because if "a" is renamed to
"A" then QFile::exists("a") will still return true on Windows.

5 years agoEnsure local discovery on selective sync changes
Christian Kamm [Wed, 13 Feb 2019 13:18:54 +0000 (14:18 +0100)]
Ensure local discovery on selective sync changes

As far as I'm aware local discovery can be skipped on folders that are
selective-sync blacklisted, so a local discovery is required when an
entry is removed from the blacklist.

Also rename
avoidReadFromDbOnNextSync() -> schedulePathForRemoteDiscovery()
since the old name might also imply it's not read from db in the local
discovery - which is not the case. Use Folder::
schedulePathForLocalDiscovery() for that.

5 years agoFix warnings about signedness
Christian Kamm [Wed, 13 Feb 2019 09:15:33 +0000 (10:15 +0100)]
Fix warnings about signedness

Sizes are always qint64, not unsigned.
TransferIds are always uint.

5 years agoTests: Fix permission propagation check
Christian Kamm [Wed, 13 Feb 2019 10:17:51 +0000 (11:17 +0100)]
Tests: Fix permission propagation check

It was using the wrong path to the conflict file.

5 years agoTest: Add check for permission propagation
Christian Kamm [Mon, 11 Feb 2019 12:25:56 +0000 (13:25 +0100)]
Test: Add check for permission propagation

Also covering propagation to the downloaded file when a conflict-rename
is done at the same time, which used to not work.

5 years agoTests: Add db checks to rename/move tests
Christian Kamm [Sat, 9 Feb 2019 16:04:42 +0000 (17:04 +0100)]
Tests: Add db checks to rename/move tests

For moves it's relevant that the old db entry is removed and the new one
is created at the right location.

5 years agoVfs: Improve sync protocol entries for actions
Christian Kamm [Fri, 8 Feb 2019 11:21:25 +0000 (12:21 +0100)]
Vfs: Improve sync protocol entries for actions

Creating a new virtual file and replacing a file with a virtual one now
have their own text in the protocol, not just "Downloaded".

To do this, the SyncFileItem type is kept as
ItemTypeVirtualFileDehydration for these actions. Added new code to
ensure the type isn't written to the database.

While looking at this, I've also added documentation on SyncFileItem's
_file, _renameTarget, _originalFile and destination() because some of
the semantics weren't clear.

5 years agoVfs: Make dehydration a SYNC and not a NEW action
Christian Kamm [Fri, 8 Feb 2019 11:18:22 +0000 (12:18 +0100)]
Vfs: Make dehydration a SYNC and not a NEW action

That change will be useful for the notifications. Previously the
dehydrated files were reported as "newly downloaded", now they're
reported as "updated".

5 years agoPropagateDownload: Create conflict even if local file changed
Christian Kamm [Wed, 6 Feb 2019 14:12:57 +0000 (15:12 +0100)]
PropagateDownload: Create conflict even if local file changed

Fixes a bug introduced while moving the attribute propagation before the
conflict-renaming.

5 years agoVfs suffix: Fix dehydration creating the wrong db entry
Christian Kamm [Wed, 6 Feb 2019 14:07:54 +0000 (15:07 +0100)]
Vfs suffix: Fix dehydration creating the wrong db entry

5 years agoVfs: Ensure VfsOff works without start() being called
Christian Kamm [Wed, 6 Feb 2019 13:44:05 +0000 (14:44 +0100)]
Vfs: Ensure VfsOff works without start() being called

In tests an un-started Vfs instance is sometimes passed to SyncEngine
via SyncOptions.

5 years agoVfs: Remove VfsDefaults
Christian Kamm [Wed, 6 Feb 2019 09:41:33 +0000 (10:41 +0100)]
Vfs: Remove VfsDefaults

That just complicated things. It's ok if Vfs is not a fully abstract
interface class.

The pinstate-in-db methods are instead provided directly on Vfs and
VfsSuffix and VfsOff use them to implement pin states.

The start() method is simply non-virtual and calls into startImpl() for
the plugin-specific startup code.

5 years agoVfs: Add option to hide socketapi pin actions
Christian Kamm [Wed, 6 Feb 2019 09:17:35 +0000 (10:17 +0100)]
Vfs: Add option to hide socketapi pin actions

Because some plugins provide alternative ui.

5 years agoPropagateDownload: Conflict-rename later
Christian Kamm [Tue, 5 Feb 2019 10:42:15 +0000 (11:42 +0100)]
PropagateDownload: Conflict-rename later

The block of code that propagated attributes etc from the previously
existing file was placed *after* the block that renamed the previously
existing file to a conflict name. That meant the propagation didn't work
in the conflict case.

5 years agoVfs: dehydration is separate action
Christian Kamm [Fri, 1 Feb 2019 10:23:00 +0000 (11:23 +0100)]
Vfs: dehydration is separate action

Allows for better attribute preservation.

Also add verifyFileUnchanged() call before dehydration to avoid data
loss when discovery takes a while.

5 years agoFile watcher: Pin state attribute changes are valid notifications
Christian Kamm [Tue, 29 Jan 2019 10:41:03 +0000 (11:41 +0100)]
File watcher: Pin state attribute changes are valid notifications

Previously they would be discarded since the file's mtime or size hadn't
changed.

5 years agoPinStates cleanup
Christian Kamm [Tue, 29 Jan 2019 09:53:47 +0000 (10:53 +0100)]
PinStates cleanup

- SyncJournalDB functions now behind internalPinStates() to avoid
accidental usage, when nearly everyone should go through Vfs.
- Rename Vfs::getPinState() to Vfs::pinState()

5 years agoFolder: Add remoteFolderTrailingSlash()
Christian Kamm [Fri, 25 Jan 2019 06:46:16 +0000 (07:46 +0100)]
Folder: Add remoteFolderTrailingSlash()

There were cases where the "/" exception wasn't handled correctly
and there'd be extra slashes in generated paths.

5 years agoVfs: Call unregisterFolder() when folder is removed
Christian Kamm [Fri, 25 Jan 2019 12:16:32 +0000 (13:16 +0100)]
Vfs: Call unregisterFolder() when folder is removed

5 years agoVfs: Enable propagating attributes on download
Christian Kamm [Fri, 25 Jan 2019 10:11:28 +0000 (11:11 +0100)]
Vfs: Enable propagating attributes on download

5 years agoSyncFileStatusTracker: Distinguish Warning and Excluded
Christian Kamm [Fri, 25 Jan 2019 10:09:50 +0000 (11:09 +0100)]
SyncFileStatusTracker: Distinguish Warning and Excluded

Any folder with a (potentially deeply) contained error will have
StatusWarning. StatusExcluded marks exclusions. The difference is useful
to know for VFS.

5 years agoPin state updates
Christian Kamm [Wed, 23 Jan 2019 14:12:02 +0000 (15:12 +0100)]
Pin state updates

- unspecified and inherited are different
- move enum to header in common/
- access through Vfs instead of directly in Journal

5 years agoVfs: Shell integration is enabled optionally
Christian Kamm [Wed, 23 Jan 2019 12:07:56 +0000 (13:07 +0100)]
Vfs: Shell integration is enabled optionally

Needs to be disabled for tests in some cases.

5 years agoVfs: Clarify SyncEngine::wipeVirtualFiles()
Christian Kamm [Wed, 23 Jan 2019 11:58:14 +0000 (12:58 +0100)]
Vfs: Clarify SyncEngine::wipeVirtualFiles()

Possibly the behavior should actually change and the function should
de-placeholder all items, not just dehydrated ones.

5 years agoDiscovery: Files can have dehydrate/download actions
Christian Kamm [Tue, 22 Jan 2019 12:32:28 +0000 (13:32 +0100)]
Discovery: Files can have dehydrate/download actions

This will be used in conjunction with vfs plugins that detect whether a
file has a pending hydration/dehydration through independent means and
communicate that to the discovery through local file type.

5 years agoDiscovery: Add signal for silentlyExcluded files
Christian Kamm [Tue, 22 Jan 2019 10:29:03 +0000 (11:29 +0100)]
Discovery: Add signal for silentlyExcluded files

This allows SyncFileStatusTracker to also know about these. After all
its information is used to provide icons for them too.