diff --git a/.tx/nextcloud.client-desktop/de_translation b/.tx/nextcloud.client-desktop/de_translation index 418dc1843..4273bd606 100644 --- a/.tx/nextcloud.client-desktop/de_translation +++ b/.tx/nextcloud.client-desktop/de_translation @@ -198,7 +198,7 @@ X-GNOME-Autostart-Delay=3 # Translations -Comment[de]=@APPLICATION_NAME@ Client zur Desktop-Synchronisation -Icon[de]=@APPLICATION_ICON_NAME@ -Name[de]=@APPLICATION_NAME@ Client zur Desktop-Synchronisation -GenericName[de]=Synchronisationsordner +Comment[de_DE]=@APPLICATION_NAME@ Client zur Desktop-Synchronisation +Icon[de_DE]=@APPLICATION_ICON_NAME@ +Name[de_DE]=@APPLICATION_NAME@ Client zur Desktop-Synchronisation +GenericName[de_DE]=Synchronisationsordner diff --git a/src/csync/csync_reconcile.cpp b/src/csync/csync_reconcile.cpp index 7256fc5b4..371db2328 100644 --- a/src/csync/csync_reconcile.cpp +++ b/src/csync/csync_reconcile.cpp @@ -204,6 +204,10 @@ static void _csync_merge_algorithm_visitor(csync_file_stat_t *cur, CSYNC * ctx) if( !cur->file_id.isEmpty() ) { other->file_id = cur->file_id; } + if (ctx->current == LOCAL_REPLICA) { + // Keep the local mtime. + other->modtime = cur->modtime; + } other->inode = cur->inode; cur->instruction = CSYNC_INSTRUCTION_NONE; // We have consumed 'other': exit this loop to not consume another one. diff --git a/test/testsyncmove.cpp b/test/testsyncmove.cpp index e51ea114b..5ca6ad293 100644 --- a/test/testsyncmove.cpp +++ b/test/testsyncmove.cpp @@ -576,6 +576,51 @@ private slots: //QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState()); } } + + // 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() }; + int nPUT = 0; + int nDELETE = 0; + int nGET = 0; + int nMOVE = 0; + fakeFolder.setServerOverride([&](QNetworkAccessManager::Operation op, const QNetworkRequest &req, QIODevice *) { + if (op == QNetworkAccessManager::PutOperation) + ++nPUT; + if (op == QNetworkAccessManager::DeleteOperation) + ++nDELETE; + if (op == QNetworkAccessManager::GetOperation) + ++nGET; + if (req.attribute(QNetworkRequest::CustomVerbAttribute) == "MOVE") + ++nMOVE; + return nullptr; + }); + + // 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(nGET, 0); + QCOMPARE(nPUT, 0); + QCOMPARE(nMOVE, 1); + QCOMPARE(nDELETE, 0); + + // Another sync should do nothing + QVERIFY(fakeFolder.syncOnce()); + QCOMPARE(nGET, 0); + QCOMPARE(nPUT, 0); + QCOMPARE(nMOVE, 1); + QCOMPARE(nDELETE, 0); + + QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState()); + } }; QTEST_GUILESS_MAIN(TestSyncMove) diff --git a/translations/client_zh_CN.ts b/translations/client_zh_CN.ts index 39e17ad83..5ba0c78cb 100644 --- a/translations/client_zh_CN.ts +++ b/translations/client_zh_CN.ts @@ -2274,7 +2274,7 @@ It is not advisable to use it. The file was renamed but is part of a read only share. The original file was restored. - 文件已经更名,但这是某个只读分享的一部分,原文件已经恢复。 + 文件已经更名,但这是某个只读共享的一部分,原文件已经恢复。 @@ -2355,7 +2355,7 @@ It is not advisable to use it. The file was edited locally but is part of a read only share. It is restored and your edit is in the conflict file. - 文件已经在本地修改,但这是某个只读分享的一部分,原文件已经恢复。您的修改已保存在冲突文件中。 + 文件已经在本地修改,但这是某个只读共享的一部分,原文件已经恢复。您的修改已保存在冲突文件中。 @@ -2581,7 +2581,7 @@ It is not advisable to use it. share label - 分享标签 + 共享标签 @@ -2596,7 +2596,7 @@ It is not advisable to use it. %1 Sharing - %1 分享 + %1 共享 @@ -2639,7 +2639,7 @@ It is not advisable to use it. Share NewDocument.odt - 分享 NewDocument.odt + 共享 NewDocument.odt @@ -2710,12 +2710,12 @@ It is not advisable to use it. Link shares have been disabled - 分享链接已被关闭 + 共享链接已被关闭 Create public link share - 创建公共分享链接 + 创建公共共享链接 @@ -2777,7 +2777,7 @@ It is not advisable to use it. Public sh&aring requires a password - 公开分享需要密码 + 公开共享需要密码 @@ -2790,12 +2790,12 @@ It is not advisable to use it. Share NewDocument.odt - 分享 NewDocument.odt + 共享 NewDocument.odt Share with users or groups ... - 分享给其他用户或组 ... + 共享给其他用户或组 ... @@ -2805,7 +2805,7 @@ It is not advisable to use it. The item is not shared with any users or groups - 本条目没有被任何用户或组分享 + 本条目没有被任何用户或组共享 @@ -2830,7 +2830,7 @@ It is not advisable to use it. I shared something with you - 我向您分享了一些东西 + 我向您共享了一些东西 @@ -2923,12 +2923,12 @@ It is not advisable to use it. I shared something with you - 我向您分享了一些东西 + 我向您共享了一些东西 Share... - 分享到... + 共享到...