mirror of
https://github.com/chylex/Nextcloud-Desktop.git
synced 2025-04-09 19:15:43 +02:00
Discovery: Query data-fingerprint on root item
Previously the property wasn't queried, meaning the fingerprint logic couldn't get triggered.
This commit is contained in:
parent
c50f041c5b
commit
fbe2dbf4ab
@ -1328,6 +1328,8 @@ DiscoverySingleDirectoryJob *ProcessDirectoryJob::startAsyncServerQuery()
|
||||
{
|
||||
auto serverJob = new DiscoverySingleDirectoryJob(_discoveryData->_account,
|
||||
_discoveryData->_remoteFolder + _currentFolder._server, this);
|
||||
if (!_dirItem)
|
||||
serverJob->setIsRootPath(); // query the fingerprint on the root
|
||||
connect(serverJob, &DiscoverySingleDirectoryJob::etag, this, &ProcessDirectoryJob::etag);
|
||||
_discoveryData->_currentlyActiveJobs++;
|
||||
_pendingAsyncJobs++;
|
||||
|
@ -207,7 +207,24 @@ private slots:
|
||||
//Server support finger print, but none is set.
|
||||
fakeFolder.remoteModifier().extraDavProperties = "<oc:data-fingerprint></oc:data-fingerprint>";
|
||||
}
|
||||
|
||||
int fingerprintRequests = 0;
|
||||
fakeFolder.setServerOverride([&](QNetworkAccessManager::Operation, const QNetworkRequest &request, QIODevice *stream) -> QNetworkReply * {
|
||||
auto verb = request.attribute(QNetworkRequest::CustomVerbAttribute);
|
||||
if (verb == "PROPFIND") {
|
||||
auto data = stream->readAll();
|
||||
if (data.contains("data-fingerprint")) {
|
||||
if (request.url().path().endsWith("webdav/"))
|
||||
++fingerprintRequests;
|
||||
else
|
||||
fingerprintRequests = -10000; // fingerprint queried on incorrect path
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
});
|
||||
|
||||
QVERIFY(fakeFolder.syncOnce());
|
||||
QCOMPARE(fingerprintRequests, 1);
|
||||
// First sync, we did not change the finger print, so the file should be downloaded as normal
|
||||
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
|
||||
QCOMPARE(fakeFolder.currentRemoteState().find("C/c1")->contentChar, 'N');
|
||||
@ -233,6 +250,7 @@ private slots:
|
||||
fakeFolder.remoteModifier().extraDavProperties = "<oc:data-fingerprint>new_finger_print</oc:data-fingerprint>";
|
||||
|
||||
QVERIFY(fakeFolder.syncOnce());
|
||||
QCOMPARE(fingerprintRequests, 2);
|
||||
auto currentState = fakeFolder.currentLocalState();
|
||||
// Altough the local file is kept as a conflict, the server file is downloaded
|
||||
QCOMPARE(currentState.find("A/a1")->contentChar, 'O');
|
||||
|
Loading…
Reference in New Issue
Block a user