From 73549a052951e761142c00f8c3c9bbda68f63cfb Mon Sep 17 00:00:00 2001 From: Klaas Freitag Date: Thu, 21 Jan 2021 13:10:05 +0100 Subject: [PATCH] Ignore the desktop.ini file in every directory, not only in top dir. (#8299) * Ignore the desktop.ini file in every directory, not only in top dir. See https://github.com/owncloud/client/issues/8298 for reasons. * Fix test for ignoring desktop.ini everywhere. Co-authored-by: Hannah von Reth --- src/csync/csync_exclude.cpp | 10 +++++----- test/testexcludedfiles.cpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/csync/csync_exclude.cpp b/src/csync/csync_exclude.cpp index f9968ae7b..84510252b 100644 --- a/src/csync/csync_exclude.cpp +++ b/src/csync/csync_exclude.cpp @@ -199,13 +199,13 @@ static CSYNC_EXCLUDE_TYPE _csync_excluded_common(const QString &path, bool exclu } #endif - /* We create a Desktop.ini on Windows for the sidebar icon, make sure we don't sync it. */ - if (blen == 11 && path == bname) { - if (bname.compare(QLatin1String("Desktop.ini"), Qt::CaseInsensitive) == 0) { - return CSYNC_FILE_SILENTLY_EXCLUDED; - } + /* Do not sync desktop.ini files anywhere in the tree. */ + const auto desktopIniFile = QStringLiteral("desktop.ini"); + if (blen == static_cast(desktopIniFile.length()) && bname.compare(desktopIniFile, Qt::CaseInsensitive) == 0) { + return CSYNC_FILE_SILENTLY_EXCLUDED; } + if (excludeConflictFiles && OCC::Utility::isConflictFile(path)) { return CSYNC_FILE_EXCLUDE_CONFLICT; } diff --git a/test/testexcludedfiles.cpp b/test/testexcludedfiles.cpp index ba48e5c2c..94b23b5b4 100644 --- a/test/testexcludedfiles.cpp +++ b/test/testexcludedfiles.cpp @@ -322,7 +322,7 @@ private slots: QCOMPARE(check_file_traversal("subdir/.sync_5bdd60bdfcfa.db"), CSYNC_FILE_SILENTLY_EXCLUDED); /* Other builtin excludes */ - QCOMPARE(check_file_traversal("foo/Desktop.ini"), CSYNC_NOT_EXCLUDED); + QCOMPARE(check_file_traversal("foo/Desktop.ini"), CSYNC_FILE_SILENTLY_EXCLUDED); QCOMPARE(check_file_traversal("Desktop.ini"), CSYNC_FILE_SILENTLY_EXCLUDED); /* pattern ]*.directory - ignore and remove */ -- 2.30.2