1
0
Fork 0
Commit Graph

228 Commits

Author SHA1 Message Date
alex-z c52718c104 Replace deprecated QRegExp with QRegularExpression.
Signed-off-by: alex-z <blackslayer4@gmail.com>
2021-11-02 08:54:06 +00:00
Felix Weilbach fb1b3481d1 Fix warnings
Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
2021-09-17 13:32:26 +00:00
Felix Weilbach 0af83dd1b6 Use QRandomGenerator instead of qrand
Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
2021-09-08 08:54:00 +00:00
allexzander ba73b6d914 VFS + E2EE. Improved data alignment and unit tests for StreamingDecryptor. Refactoring and renaming for readability.
Signed-off-by: allexzander <blackslayer4@gmail.com>
2021-08-20 12:57:22 +00:00
allexzander 2c78925acb VFS + E2EE VFS implicit hydration of E2EE files.
Signed-off-by: allexzander <blackslayer4@gmail.com>
2021-08-20 12:57:22 +00:00
Felix Weilbach d72f7e9109 Check result of setPinState()
Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
2021-08-11 20:20:39 +00:00
Hannah von Reth 6e0a43b570 Fix clash detection with virtual files
Fixes: #8323
2021-08-11 17:13:44 +00:00
allexzander 8122c63ebc Revert Added config parameter that allows to bypass checksum validation failure.
Signed-off-by: allexzander <blackslayer4@gmail.com>
2021-07-28 07:57:10 +00:00
Hannah von Reth e7e218d8e6 Improve the error message returned by updateMetadata
Also properly handle the case the the file can't be converted to a placeholder
as it is locked
2021-07-06 14:03:53 +00:00
Felix Weilbach c799dbdd61 Cfapi: Make sure no data is transfered after cancellation
Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
2021-06-17 09:10:06 +00:00
allexzander dc72686ab3 Allow download with mismatched checksum if a config option is set.
Signed-off-by: allexzander <blackslayer4@gmail.com>
2021-06-10 13:39:11 +03:00
AJ Jordan a51d0a14db Improve error message
This one is more user-friendly and grammatically correct.

Signed-off-by: AJ Jordan <alex@strugee.net>
2021-06-03 11:25:47 +00:00
allexzander d754bb7102 Fix review comments.
Signed-off-by: allexzander <blackslayer4@gmail.com>
2021-05-06 06:17:36 +00:00
allexzander ef89256d39 VFS. Allow dehydartion of readonly files. Preserve 'readonly' flag when creating a placeholder.
Signed-off-by: allexzander <blackslayer4@gmail.com>
2021-05-06 06:17:36 +00:00
allexzander 19522210ac VFS. Display local file name clash error when syncing in VFS mode.
Signed-off-by: allexzander <blackslayer4@gmail.com>
2021-05-05 17:34:59 +00:00
Matthieu Gallien 782a2fdf06 avoid an assert by delaying access to response timestamp when in error
when canceling the sync of a big directory, I can get some network
request that are aborted before a Date reply header has been read

in this case we would always access
AbstractNetworkJob::responseTimestamp() and fire the assert even if we
know that the network reply has an error

delay the access to after the possible errors have been dealt with

Signed-off-by: Matthieu Gallien <matthieu_gallien@yahoo.fr>
2021-04-20 17:42:17 +02:00
Valdnet e628a51735 l10n: Unify spelling
Spelling unification in Nextcloud applications.

Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
2021-04-13 12:24:57 +02:00
Felix Weilbach 9bf5b5c7ba CFAPI: Handle cancelation of hydration requests
Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
2021-03-18 10:43:48 +00:00
Kevin Ottens 7c8b7db725
Don't detect file changes during hydration for virtual files
Indeed, that file size will almost always change between the 1 byte
placeholder and the hydrated file. Only when using the CfAPI on Windows
this won't be the case since because it will expose the original size
even for placeholders.

Also worth noting: the suffix backend didn't hit that case since the
filename changes (with suffix for placeholders, without for hydrated
files).

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2021-01-14 12:57:03 +01:00
Hannah von Reth aadda32633
Handle errors in convertToPlaceholder 2020-12-30 16:17:47 +01:00
Kevin Ottens c57eff6fd8
Please the clang-tidy overlord
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-12-15 11:01:53 +01:00
Hannah von Reth ebd8047cb6
Replace custome date parser QDateTime::fromString(value, Qt::RFC2822Date) 2020-12-15 11:01:52 +01:00
Hannah von Reth 1b4ccea083
Owncloud - virtual files smaller <1KB - problems with syncing
The issue was caused by gziped responses not providing a
content lenght header.

Fixes: #8248
2020-12-15 10:59:27 +01:00
Kevin Ottens 36b8e7c2a4
Remove the encryption flag check from encrypted propagation code
If we use those encrypted propagation code paths, we already know from
the discovery phase (and thus the journal db) that the folders are
encrypted so no need to check again.

This will remove another expensive round trip with the server.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-12-15 10:59:23 +01:00
Kevin Ottens 7a4a359704
Stop using e2e()->isFolderEncrypted() in the jobs
Thanks to the new discovery algorithm, we got all the freshest E2EE
information straight from the database so reuse it instead of going
through an in memory copy.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-12-15 10:59:22 +01:00
Kevin Ottens af00ef1cca
Don't use getFileRecordByE2eMangledName in jobs anymore
Thanks to the new discovery algorithm we got both mangled and original
file names in the item so no need to go through the database for
nothing.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-12-15 10:59:21 +01:00
Hannah von Reth 93152761a1
Use verbose function names instead of direct member access 2020-12-15 10:59:20 +01:00
Hannah von Reth c1a91e91e7
Use the servers checksum type by default 2020-12-15 10:59:16 +01:00
Olivier Goffart 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 Goffart 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
Christian Kamm 3446412d92
PropagateDownload: Don't try to open readonly temporaries
This situation could arrise when receiving a read-only share and the
temporary rename failed for some reason.

See #7419
2020-12-15 10:58:58 +01:00
Christian Kamm ea829f96ca
Download: Don't trigger too many concurrent hash computations
Previously the job would only become "active" when the downloads
started. That meant that arbitrarily many hash computations could be
queued at the same time.

Since the the file was opened during future creation this could lead to
a "too many open files" problem if there were lots of new-new conflicts.

To change this:
- Make PropagateDownload become active when computing a hash
  asynchronously.
- Make the computation future open the file only once it gets run. This
  will make it less likely for this problem to occur even if thousands
  of these futures are queued.

For #7372
2020-12-15 10:58:55 +01:00
Christian Kamm 00dcf3ef59
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.
2020-12-15 10:58:53 +01:00
Christian Kamm 5bc2180478
Vfs: Preserve pin state on hydration
For #7322 and #7323
2020-12-15 10:58:53 +01:00
Christian Kamm 5acb157a7e
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.
2020-12-15 10:58:52 +01:00
Christian Kamm a7852e3aba
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.
2020-12-15 10:58:51 +01:00
Christian Kamm 3f55f9302e
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.
2020-12-15 10:58:45 +01:00
Christian Kamm 47f10fbf96
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.
2020-12-15 10:58:44 +01:00
Christian Kamm 238ac53666
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.
2020-12-15 10:58:41 +01:00
Christian Kamm 4c04351360
Fix warnings about signedness
Sizes are always qint64, not unsigned.
TransferIds are always uint.
2020-12-15 10:58:41 +01:00
Christian Kamm 910ccaf600
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.
2020-12-15 10:58:41 +01:00
Christian Kamm 797734870f
PropagateDownload: Create conflict even if local file changed
Fixes a bug introduced while moving the attribute propagation before the
conflict-renaming.
2020-12-15 10:58:40 +01:00
Christian Kamm 8a8e93827f
Vfs suffix: Fix dehydration creating the wrong db entry 2020-12-15 10:58:40 +01:00
Christian Kamm e6ee5d0f8a
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.
2020-12-15 10:58:39 +01:00
Christian Kamm 6c5fa1dadd
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.
2020-12-15 10:58:39 +01:00
Christian Kamm 597cc60f52
Vfs: Enable propagating attributes on download 2020-12-15 10:58:38 +01:00
Christian Kamm 31394f14b5
Vfs: Make files that end up in db placeholders
Since 'placeholder' just means that it's an item of the special type
that the vfs plugin can deal with - no matter whether hydrated or
dehydrated - all done items should become placeholders. Even
directories.

Now every file that passes through updateMetadata() will be converted to
a placeholder if necessary.
2020-12-15 10:58:37 +01:00
Christian Kamm ca0323e1e7
Propagator: Helper for updating db
Similar steps were done in many propagation jobs.

This also updates the db entry to always have the item.destination() as
file path.
2020-12-15 10:58:37 +01:00
Christian Kamm 1a250bc3c7
Download: Ignore content-length for compressed HTTP2/SPDY replies #6885
It contains the compressed size.

See https://bugreports.qt.io/browse/QTBUG-73364
2020-12-15 10:58:36 +01:00
Olivier Goffart 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