From d47e955a10aa66c4bf7036e7d547d15d4f5ce7d3 Mon Sep 17 00:00:00 2001 From: tomdereub Date: Tue, 27 Sep 2022 13:22:34 +0200 Subject: [PATCH 1/3] windows reserved word silently excluded - csync exclude.cpp Proposal to solve https://github.com/nextcloud/desktop/issues/3826, by excluding silently windows reserved word like $RECYCLE.BIN. Signed-off-by: tomdereub --- src/csync/csync_exclude.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/csync/csync_exclude.cpp b/src/csync/csync_exclude.cpp index 9efe50df3916..5c3ab723ceda 100644 --- a/src/csync/csync_exclude.cpp +++ b/src/csync/csync_exclude.cpp @@ -174,7 +174,7 @@ static CSYNC_EXCLUDE_TYPE _csync_excluded_common(const QString &path, bool exclu } if (csync_is_windows_reserved_word(bname)) { - return CSYNC_FILE_EXCLUDE_INVALID_CHAR; + return CSYNC_FILE_SILENTLY_EXCLUDED; } // Filter out characters not allowed in a filename on windows From 488decb2f7757d2cee30951059d8aa20817ac741 Mon Sep 17 00:00:00 2001 From: tomdereub Date: Sat, 8 Oct 2022 21:49:09 +0200 Subject: [PATCH 2/3] Adapt test to silent exclusion Signed-off-by: tomdereub --- test/testexcludedfiles.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/testexcludedfiles.cpp b/test/testexcludedfiles.cpp index 0e05a27e4c9d..95713867b9ff 100644 --- a/test/testexcludedfiles.cpp +++ b/test/testexcludedfiles.cpp @@ -196,7 +196,7 @@ private slots: QCOMPARE(check_file_full("file_trailing_space "), CSYNC_NOT_EXCLUDED); QCOMPARE(check_file_full(" file_leading_and_trailing_space "), CSYNC_NOT_EXCLUDED); QCOMPARE(check_file_full("file_trailing_dot."), CSYNC_FILE_EXCLUDE_INVALID_CHAR); - QCOMPARE(check_file_full("AUX"), CSYNC_FILE_EXCLUDE_INVALID_CHAR); + QCOMPARE(check_file_full("AUX"), CSYNC_FILE_SILENTLY_EXCLUDED); QCOMPARE(check_file_full("file_invalid_char<"), CSYNC_FILE_EXCLUDE_INVALID_CHAR); QCOMPARE(check_file_full("file_invalid_char\n"), CSYNC_FILE_EXCLUDE_INVALID_CHAR); #endif From af420f3c9e66bf047edf10990df1eb3681c58ce8 Mon Sep 17 00:00:00 2001 From: tomdereub Date: Sat, 8 Oct 2022 23:42:48 +0200 Subject: [PATCH 3/3] Adapt test 2 Signed-off-by: tomdereub --- test/testexcludedfiles.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/testexcludedfiles.cpp b/test/testexcludedfiles.cpp index 95713867b9ff..458435da9b59 100644 --- a/test/testexcludedfiles.cpp +++ b/test/testexcludedfiles.cpp @@ -352,7 +352,7 @@ private slots: QCOMPARE(check_file_traversal("file_trailing_space "), CSYNC_NOT_EXCLUDED); QCOMPARE(check_file_traversal(" file_leading_and_trailing_space "), CSYNC_NOT_EXCLUDED); QCOMPARE(check_file_traversal("file_trailing_dot."), CSYNC_FILE_EXCLUDE_INVALID_CHAR); - QCOMPARE(check_file_traversal("AUX"), CSYNC_FILE_EXCLUDE_INVALID_CHAR); + QCOMPARE(check_file_traversal("AUX"), CSYNC_FILE_SILENTLY_EXCLUDED); QCOMPARE(check_file_traversal("file_invalid_char<"), CSYNC_FILE_EXCLUDE_INVALID_CHAR); #endif