From: Christian Kamm Date: Fri, 1 Mar 2019 08:33:55 +0000 (+0100) Subject: Windows: Forbid chars 0-31 in filenames #6987 X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~21^2~468^2~282 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=575935ded08164739d52ae9f111c6c3f8e308c50;p=nextcloud-desktop.git Windows: Forbid chars 0-31 in filenames #6987 --- diff --git a/src/csync/csync_exclude.cpp b/src/csync/csync_exclude.cpp index 8233a6b1f..902dffc76 100644 --- a/src/csync/csync_exclude.cpp +++ b/src/csync/csync_exclude.cpp @@ -187,7 +187,11 @@ static CSYNC_EXCLUDE_TYPE _csync_excluded_common(const QString &path, bool exclu // Filter out characters not allowed in a filename on windows for (auto p : path) { - switch (p.unicode()) { + const ushort c = p.unicode(); + if (c < 32) { + return CSYNC_FILE_EXCLUDE_INVALID_CHAR; + } + switch (c) { case '\\': case ':': case '?': diff --git a/test/testexcludedfiles.cpp b/test/testexcludedfiles.cpp index cb6b3c1a2..f00683e88 100644 --- a/test/testexcludedfiles.cpp +++ b/test/testexcludedfiles.cpp @@ -193,10 +193,10 @@ private slots: #ifdef _WIN32 QCOMPARE(check_file_full("file_trailing_space "), CSYNC_FILE_EXCLUDE_TRAILING_SPACE); - 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("file_invalid_char<"), CSYNC_FILE_EXCLUDE_INVALID_CHAR); + QCOMPARE(check_file_full("file_invalid_char\n"), CSYNC_FILE_EXCLUDE_INVALID_CHAR); #endif /* ? character */