remove the enforcement of identical etag for a server side item MOVE

orignally added by https://github.com/owncloud/client/pull/6632

most probably a too strong assumption on the behavior of the Nextcloud
server

better check real item metadata like fileid, size or modification time

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
This commit is contained in:
Matthieu Gallien 2024-10-16 12:10:10 +02:00
Родитель f0908dbbfc
Коммит 05b6db55c3
2 изменённых файлов: 2 добавлений и 35 удалений

Просмотреть файл

@ -912,9 +912,8 @@ void ProcessDirectoryJob::processFileAnalyzeRemoteInfo(const SyncFileItemPtr &it
done = true;
return;
}
if (!serverEntry.isDirectory && base._etag != serverEntry.etag) {
/* File with different etag, don't do a rename, but download the file again */
qCInfo(lcDisco, "file etag different, not a rename");
if (!serverEntry.isDirectory && (base._modtime != serverEntry.modtime || base._fileSize != serverEntry.size)) {
qCInfo(lcDisco, "file metadata different, forcing a download of the new file");
done = true;
return;
}

Просмотреть файл

@ -741,38 +741,6 @@ private slots:
}
}
// https://github.com/owncloud/client/issues/6629#issuecomment-402450691
// When a file is moved and the server mtime was not in sync, the local mtime should be kept
void testMoveAndMTimeChange()
{
FakeFolder fakeFolder{ FileInfo::A12_B12_C12_S12() };
OperationCounter counter;
fakeFolder.setServerOverride(counter.functor());
// Changing the mtime on the server (without invalidating the etag)
fakeFolder.remoteModifier().find("A/a1")->lastModified = QDateTime::currentDateTimeUtc().addSecs(-50000);
fakeFolder.remoteModifier().find("A/a2")->lastModified = QDateTime::currentDateTimeUtc().addSecs(-40000);
// Move a few files
fakeFolder.remoteModifier().rename("A/a1", "A/a1_server_renamed");
fakeFolder.localModifier().rename("A/a2", "A/a2_local_renamed");
QVERIFY(fakeFolder.syncOnce());
QCOMPARE(counter.nGET, 0);
QCOMPARE(counter.nPUT, 0);
QCOMPARE(counter.nMOVE, 1);
QCOMPARE(counter.nDELETE, 0);
// Another sync should do nothing
QVERIFY(fakeFolder.syncOnce());
QCOMPARE(counter.nGET, 0);
QCOMPARE(counter.nPUT, 0);
QCOMPARE(counter.nMOVE, 1);
QCOMPARE(counter.nDELETE, 0);
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
}
// Test for https://github.com/owncloud/client/issues/6694
void testInvertFolderHierarchy()
{