relax fat FS filename restrictions

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
(cherry picked from commit a587de8553)
This commit is contained in:
Trial97 2024-06-17 13:35:23 +03:00 committed by github-actions[bot]
parent 580e38a985
commit 0ea9190d25

View File

@ -801,20 +801,11 @@ QString NormalizePath(QString path)
} }
} }
QString removeDuplicates(QString a) static const QString BAD_WIN_CHARS = "<>:\"|?*\r\n";
{
auto b = a.split("");
b.removeDuplicates();
return b.join("");
}
static const QString BAD_WIN_CHARS = "\"?<>:*|\r\n";
static const QString BAD_FAT_CHARS = "<>:\"|?*+.,;=[]!";
static const QString BAD_NTFS_CHARS = "<>:\"|?*"; static const QString BAD_NTFS_CHARS = "<>:\"|?*";
static const QString BAD_HFS_CHARS = ":"; static const QString BAD_HFS_CHARS = ":";
static const QString BAD_FILENAME_CHARS = removeDuplicates(BAD_WIN_CHARS + BAD_FAT_CHARS + BAD_NTFS_CHARS + BAD_HFS_CHARS) + "\\/"; static const QString BAD_FILENAME_CHARS = BAD_WIN_CHARS + "\\/";
QString RemoveInvalidFilenameChars(QString string, QChar replaceWith) QString RemoveInvalidFilenameChars(QString string, QChar replaceWith)
{ {
@ -833,9 +824,8 @@ QString RemoveInvalidPathChars(QString path, QChar replaceWith)
// the null character is ignored in this check as it was not a problem until now // the null character is ignored in this check as it was not a problem until now
switch (statFS(path).fsType) { switch (statFS(path).fsType) {
case FilesystemType::FAT: case FilesystemType::FAT: // similar to NTFS
invalidChars += BAD_FAT_CHARS; /* fallthrough */
break;
case FilesystemType::NTFS: case FilesystemType::NTFS:
/* fallthrough */ /* fallthrough */
case FilesystemType::REFS: // similar to NTFS(should be available only on windows) case FilesystemType::REFS: // similar to NTFS(should be available only on windows)