-
Notifications
You must be signed in to change notification settings - Fork 997
fix: try to correct mtime on upsyncs #8095
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1751,6 +1751,10 @@ private slots: | |
| return {}; | ||
| }; | ||
|
|
||
| const auto lastModified = [&](const QString &path) -> qint64 { | ||
| return fakeFolder.currentLocalState().find(path)->lastModified.toSecsSinceEpoch(); | ||
| }; | ||
|
|
||
| fakeFolder.localModifier().insert(fooFileRootFolder); | ||
| fakeFolder.localModifier().insert(barFileRootFolder); | ||
| fakeFolder.localModifier().mkdir(QStringLiteral("subfolder")); | ||
|
|
@@ -1765,24 +1769,33 @@ private slots: | |
| fakeFolder.scheduleSync(); | ||
| fakeFolder.execUntilBeforePropagation(); | ||
|
|
||
| QCOMPARE(checkStatus(), SyncFileStatus::StatusError); | ||
| QCOMPARE(checkStatus(), SyncFileStatus::StatusSync); | ||
|
|
||
| fakeFolder.execUntilFinished(); | ||
|
|
||
| // ensure mtime has changed after the sync | ||
| QCOMPARE_GT(lastModified(barFileAaaSubFolder), CURRENT_MTIME); | ||
|
|
||
| fakeFolder.localModifier().setModTime(barFileAaaSubFolder, QDateTime::fromSecsSinceEpoch(CURRENT_MTIME)); | ||
|
|
||
| QVERIFY(fakeFolder.syncOnce()); | ||
|
|
||
| // ensure mtime is now CURRENT_MTIME | ||
| QCOMPARE(lastModified(barFileAaaSubFolder), CURRENT_MTIME); | ||
|
|
||
| fakeFolder.localModifier().appendByte(barFileAaaSubFolder); | ||
| fakeFolder.localModifier().setModTime(barFileAaaSubFolder, QDateTime::fromSecsSinceEpoch(INVALID_MTIME1)); | ||
|
|
||
| fakeFolder.scheduleSync(); | ||
| fakeFolder.execUntilBeforePropagation(); | ||
|
|
||
| QCOMPARE(checkStatus(), SyncFileStatus::StatusError); | ||
| QCOMPARE(checkStatus(), SyncFileStatus::StatusSync); | ||
|
|
||
| fakeFolder.execUntilFinished(); | ||
|
|
||
| // ensure mtime has changed after the sync | ||
| QCOMPARE_GT(lastModified(barFileAaaSubFolder), CURRENT_MTIME); | ||
|
|
||
| fakeFolder.localModifier().setModTime(barFileAaaSubFolder, QDateTime::fromSecsSinceEpoch(CURRENT_MTIME)); | ||
|
|
||
| QVERIFY(fakeFolder.syncOnce()); | ||
|
|
@@ -1793,7 +1806,11 @@ private slots: | |
| fakeFolder.scheduleSync(); | ||
| fakeFolder.execUntilBeforePropagation(); | ||
|
|
||
| QCOMPARE(checkStatus(), SyncFileStatus::StatusError); | ||
| QCOMPARE(checkStatus(), SyncFileStatus::StatusSync); | ||
|
|
||
| // the server only considers an mtime of 0-86400 (1d) as invalid, so this is fine | ||
| // see also: apps/dav/lib/Connector/Sabre/MtimeSanitizer.php | ||
| QCOMPARE(lastModified(barFileAaaSubFolder), INVALID_MTIME2); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. of course Windows doesn't like that change
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh my, it's even worse than that
on x64 Linux a |
||
|
|
||
| fakeFolder.execUntilFinished(); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that would differ from server behavior
modification time of the server side file should be what is in the header
x-oc-mtimeUh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not really --
request.rawHeaderonly contains the headers of the HTTP request itself, not the multipart-part that's being uploaded (andmodtimeis set to the value from the multipart headers)while cross-checking this I just saw that the header used for the
modtimevariable uses thex-file-mtimemultipart header, which has a TODO set on the server side to be replaced withx-oc-mtime... https://github.com/nextcloud/server/blob/c029616ec05f363b28467bbdccd5ce806fd43212/apps/dav/lib/BulkUpload/BulkUploadPlugin.php#L61-L68