Commit Graph

543 Commits

Author SHA1 Message Date
Christian Kamm
199163187a Vfs: Preserve pin state on hydration
For #7322 and #7323
2019-07-18 20:00:28 +02:00
Christian Kamm
aafa903a02 Drone: Skip DatabaseErrorTest
It seems reliable when run manually, but frequently breaks when executed
by drone.
2019-07-15 11:37:59 +02:00
Christian Kamm
75ddb8dd80 Vfs: Make test pass with different suffix #7279 2019-06-28 10:48:18 +02:00
Christian Kamm
6b89747a26 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.
2019-06-27 15:57:20 +02:00
Christian Kamm
86b15ffb20 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
2019-06-27 13:08:18 +02:00
Christian Kamm
02a9b16b0f Vfs: Move pin state if files move #7250
Previously renames of items didn't carry the pin state with them.
2019-06-23 10:23:37 +02:00
Christian Kamm
e653924e06 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.
2019-06-23 10:23:37 +02:00
Christian Kamm
86d36f0a78 Merge remote-tracking branch 'origin/2.5' into 2.6 2019-06-12 13:23:41 +02:00
Christian Kamm
98ba64e60c 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.

(cherry picked from commit 677e44dc53)

Cherry-picked to allow 2.5 users with new enough Qt to test the HTTP2
workaround.
2019-06-12 13:16:32 +02:00
Christian Kamm
677e44dc53 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.
2019-06-07 19:26:19 +02:00
Christian Kamm
962fafaf9e Tests: Fix DB locking issue in permissions test
(cherry picked from commit 3fb4a540da)
2019-06-07 09:30:52 +02:00
Olivier Goffart
cb26f516f7 Discovery: Do not abort the sync in case of error 404 (or 500)
Issue: #7199
2019-06-05 11:09:16 +02:00
Olivier Goffart
819175ad89 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
2019-06-04 15:56:35 +02:00
Markus Goetz
dc2a37e813 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
2019-05-15 09:58:59 +02:00
Christian Kamm
87cd1c38be Merge remote-tracking branch 'origin/2.5' into 2.6 2019-05-13 07:51:54 +02:00
Christian Kamm
87a6e039a7 Chunked upload: Fix percent encoding in If header #7176 2019-05-07 10:09:18 +02:00
Christian Kamm
3fb4a540da Tests: Fix DB locking issue in permissions test 2019-05-07 08:25:49 +02:00
Christian Kamm
9b01dbae4c Tests: fix vfs availability test case 2019-05-07 08:21:46 +02:00
Christian Kamm
b0886cd9b1 Fix compile for Debian 8 2019-04-29 12:52:07 +02:00
Christian Kamm
96831247e2 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.
2019-04-23 09:21:17 +02:00
Christian Kamm
1e1340b457 Merge remote-tracking branch 'origin/2.5' into 2.6 2019-04-17 13:43:53 +02:00
Christian Kamm
6a7b138aa6 Discovery: Query data-fingerprint on root item
Previously the property wasn't queried, meaning the fingerprint logic
couldn't get triggered.
2019-04-12 12:18:02 +02:00
Christian Kamm
440c06c54a 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.
2019-04-11 13:48:56 +02:00
Christian Kamm
77011e0cde Tests: Allow vfs tests to enable shell integration
Necessary for testing 2b0f32c645
2019-04-10 08:13:46 +02:00
Christian Kamm
2b0f32c645 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.
2019-04-09 12:52:30 +02:00
Christian Kamm
04268becd1 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.
2019-04-09 12:46:35 +02:00
Christian Kamm
f7d4b29df9 PropagateDirectory: Set initial dir mtime to server mtime #7119
It's still not synced in any way later.
2019-04-09 10:10:41 +02:00
Christian Kamm
ca003823d5 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
2019-04-09 10:09:56 +02:00
Christian Kamm
83c30f7dc7 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.
2019-04-09 10:09:34 +02:00
Christian Kamm
aca19c7a6d 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.
2019-03-28 17:30:28 +01:00
Christian Kamm
ca7b4be189 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.
2019-03-28 17:30:19 +01:00
Olivier Goffart
a2c7e1a43c Test: fix compilation with GCC 4.9
It does not appear to support variadic lambda
2019-03-22 16:34:41 +01:00
Christian Kamm
b181740b30 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.
2019-03-21 11:13:16 +01:00
Olivier Goffart
3093ef55d2 Upload: asynchronious operations
Implements https://github.com/owncloud/core/pull/31851
2019-03-20 12:30:35 +01:00
Christian Kamm
f1c7a9511f 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.
2019-03-18 10:10:01 +01:00
Christian Kamm
db866afb60 Merge remote-tracking branch 'origin/2.5' 2019-03-14 08:34:19 +01:00
Christian Kamm
cb5a76729a FolderWatcher linux: Make automatically recursive #7068
Previously it depended on addFolder() / removeFolder() calls to adjust
watchers when new folders were added or removed. There also needed to be
complex move handling.

Now, any folder creation/move-in notifications automatically trigger
watcher additions and folder deletion/move-out triggers removal.
2019-03-14 08:14:27 +01:00
Olivier Goffart
6b467acf38 Download: Remove useless code and add a test
From issue #7015, the code is wrong because the path is the file system path and
not the path on the DB.
But since this is a conflict, this means the reconcile will still want to download
the file from the server next sync, so we need not to worry about this case
2019-03-05 09:17:47 +01:00
Christian Kamm
a39f4a532f 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.
2019-03-05 09:15:38 +01:00
Christian Kamm
221b8680e4 Merge remote-tracking branch 'origin/2.5' 2019-03-04 09:36:29 +01:00
Christian Kamm
5c7a89a40e Windows: Forbid chars 0-31 in filenames #6987 2019-03-02 09:08:19 +01:00
Christian Kamm
3d18e52017 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.
2019-02-28 08:43:41 +01:00
Christian Kamm
a627f373b1 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.
2019-02-14 10:57:09 +01:00
Christian Kamm
89753773e3 Fix warnings about signedness
Sizes are always qint64, not unsigned.
TransferIds are always uint.
2019-02-14 10:53:33 +01:00
Christian Kamm
fb6446b3e5 Tests: Fix permission propagation check
It was using the wrong path to the conflict file.
2019-02-13 20:47:33 +01:00
Christian Kamm
5673879f40 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.
2019-02-11 13:35:14 +01:00
Christian Kamm
5d777604f4 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.
2019-02-11 13:35:14 +01:00
Christian Kamm
f786ef1430 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.
2019-02-11 13:35:14 +01:00
Christian Kamm
9b7eba0174 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".
2019-02-11 13:35:14 +01:00
Christian Kamm
30d7157eb8 Vfs suffix: Fix dehydration creating the wrong db entry 2019-02-11 13:35:14 +01:00