Windows: Forbid chars 0-31 in filenames #6987

This commit is contained in:
Christian Kamm 2019-03-01 09:33:55 +01:00 committed by Kevin Ottens
parent a72bf89779
commit 575935ded0
No known key found for this signature in database
GPG key ID: 074BBBCB8DECC9E2
2 changed files with 6 additions and 2 deletions

View file

@ -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 '?':

View file

@ -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 */