From ac3fc531ff5b0c512cb0bca53fb118d8a7a749b8 Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Mon, 14 Aug 2023 19:43:31 +0200 Subject: [PATCH 1/2] test that discovery of file names with UTF-8 is working Signed-off-by: Matthieu Gallien --- test/testsyncengine.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/testsyncengine.cpp b/test/testsyncengine.cpp index f4c4c023664ec..24cb3e75113ed 100644 --- a/test/testsyncengine.cpp +++ b/test/testsyncengine.cpp @@ -1717,6 +1717,15 @@ private slots: QVERIFY(fakeFolder.syncOnce()); QCOMPARE(spy.count(), 1); } + + void testFileDownloadWithUnicodeCharacterInName() { + FakeFolder fakeFolder{FileInfo::A12_B12_C12_S12()}; + ItemCompletedSpy completeSpy(fakeFolder); + fakeFolder.remoteModifier().insert("A/abcdęfg.txt"); + fakeFolder.syncOnce(); + QVERIFY(itemDidCompleteSuccessfully(completeSpy, "A/abcdęfg.txt")); + QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState()); + } }; QTEST_GUILESS_MAIN(TestSyncEngine) From f90cb239f3202065ad99026a4db5acd0b5870ab6 Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Mon, 14 Aug 2023 18:40:49 +0200 Subject: [PATCH 2/2] on windows file names can always be encoded: fix wrong test inspired by https://github.com/owncloud/client/pull/6820 Close #5935 Signed-off-by: Matthieu Gallien --- src/libsync/discovery.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libsync/discovery.cpp b/src/libsync/discovery.cpp index 8d24b56f633a8..ee694c2bb0315 100644 --- a/src/libsync/discovery.cpp +++ b/src/libsync/discovery.cpp @@ -291,10 +291,10 @@ bool ProcessDirectoryJob::handleExcluded(const QString &path, const Entries &ent } auto localCodec = QTextCodec::codecForLocale(); - if (localCodec->mibEnum() != 106) { + if (!OCC::Utility::isWindows() && localCodec->mibEnum() != 106) { // If the locale codec is not UTF-8, we must check that the filename from the server can // be encoded in the local file system. - // + // (Note: on windows, the FS is always UTF-16, so we don't need to check) // // We cannot use QTextCodec::canEncode() since that can incorrectly return true, see // https://bugreports.qt.io/browse/QTBUG-6925. QTextEncoder encoder(localCodec, QTextCodec::ConvertInvalidToNull);