diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2017-11-20 10:18:52 +0300 |
---|---|---|
committer | Olivier Goffart <olivier@woboq.com> | 2017-11-20 12:51:15 +0300 |
commit | 480932a58a5a3558d0a4489f9d350007fb2d2c0b (patch) | |
tree | 3e9b6c76ca0e361f091672a11a7a6ac408f77041 /test/testsyncengine.cpp | |
parent | 529bcab009232b765420405b9c386c27972affb5 (diff) |
Checksum: Ignore unkown OC-Checksum header when downloading...
And if there are several checksums, pick the "best" one.
The case of several checksum was reported in
https://github.com/nextcloud/client_theming/issues/213
Diffstat (limited to 'test/testsyncengine.cpp')
-rw-r--r-- | test/testsyncengine.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/test/testsyncengine.cpp b/test/testsyncengine.cpp index ab387ac88..10e5e9acd 100644 --- a/test/testsyncengine.cpp +++ b/test/testsyncengine.cpp @@ -510,11 +510,25 @@ private slots: QVERIFY(fakeFolder.syncOnce()); QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState()); - // OC-Checksum has preference + // Invalid OC-Checksum is ignored checksumValue = "garbage"; // contentMd5Value is still good fakeFolder.remoteModifier().create("A/a6", 16, 'A'); + QVERIFY(fakeFolder.syncOnce()); + contentMd5Value = "bad"; + fakeFolder.remoteModifier().create("A/a7", 16, 'A'); QVERIFY(!fakeFolder.syncOnce()); + contentMd5Value.clear(); + QVERIFY(fakeFolder.syncOnce()); + QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState()); + + // OC-Checksum contains Unsupported checksums + checksumValue = "Unsupported:XXXX SHA1:invalid Invalid:XxX"; + fakeFolder.remoteModifier().create("A/a8", 16, 'A'); + QVERIFY(!fakeFolder.syncOnce()); // Since the supported SHA1 checksum is invalid, no download + checksumValue = "Unsupported:XXXX SHA1:19b1928d58a2030d08023f3d7054516dbc186f20 Invalid:XxX"; + QVERIFY(fakeFolder.syncOnce()); // The supported SHA1 checksum is valid now, so the file are downloaded + QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState()); } // Tests the behavior of invalid filename detection |