Skip to content

Commit

Permalink
Ignore the desktop.ini file in every directory, not only in top dir. …
Browse files Browse the repository at this point in the history
…(#8299)

* Ignore the desktop.ini file in every directory, not only in top dir.

See owncloud/client#8298  for reasons.

* Fix test for ignoring desktop.ini everywhere.

Co-authored-by: Hannah von Reth <hannah.vonreth@owncloud.com>
  • Loading branch information
2 people authored and mgallien committed Aug 16, 2021
1 parent 8c8b59a commit 2c17a1f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/csync/csync_exclude.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<size_t>(desktopIniFile.length()) && bname.compare(desktopIniFile, Qt::CaseInsensitive) == 0) {
return CSYNC_FILE_SILENTLY_EXCLUDED;
}


if (excludeConflictFiles && OCC::Utility::isConflictFile(path)) {
return CSYNC_FILE_EXCLUDE_CONFLICT;
}
Expand Down
2 changes: 1 addition & 1 deletion test/testexcludedfiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 2c17a1f

Please sign in to comment.