Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannah von Reth <hannah.vonreth@owncloud.com>2021-11-18 12:43:30 +0300
committerHannah von Reth <vonreth@kde.org>2021-11-23 20:55:34 +0300
commit49842dbd6edfd7c0aee2b3871991cc2438b0172a (patch)
tree2d732c3479ff2822f5b50c3893a67719c97433fc
parentce52b2e5a4888db9f8b27ad769acc4d679740359 (diff)
Display correct error message for files containign `\:?*"<>|`
-rw-r--r--changelog/unreleased/922310
-rw-r--r--src/libsync/discovery.cpp20
2 files changed, 22 insertions, 8 deletions
diff --git a/changelog/unreleased/9223 b/changelog/unreleased/9223
new file mode 100644
index 000000000..e8411e96d
--- /dev/null
+++ b/changelog/unreleased/9223
@@ -0,0 +1,10 @@
+Bugfix: Display correct error message for files containign `\:?*"<>|`
+
+While the error message was supposed to be:
+`File names containing the character '%1' are not supported on this file system.`
+
+We displayed:
+`The file name is a reserved name on this file system.`
+
+https://github.com/owncloud/client/pull/9223/
+
diff --git a/src/libsync/discovery.cpp b/src/libsync/discovery.cpp
index fac99ccf4..4dd5bc695 100644
--- a/src/libsync/discovery.cpp
+++ b/src/libsync/discovery.cpp
@@ -250,16 +250,20 @@ bool ProcessDirectoryJob::handleExcluded(const QString &path, const QString &loc
if (item->_file.endsWith(QLatin1Char('.'))) {
item->_errorString = tr("File names ending with a period are not supported on this file system.");
} else {
- const auto unsupportedCharacters = QStringLiteral("\\:?*\"<>|");
- for (const auto &x : unsupportedCharacters) {
- if (item->_file.contains(x)) {
- item->_errorString = tr("File names containing the character '%1' are not supported on this file system.")
- .arg(x);
- break;
+ const auto unsupportedCharacter = [](const QString &fName) {
+ const auto unsupportedCharacter = QStringLiteral("\\:?*\"<>|");
+ for (const auto &x : unsupportedCharacter) {
+ if (fName.contains(x)) {
+ return x;
+ }
}
- }
+ return QChar();
+ }(item->_file);
- if (isInvalidPattern) {
+ if (!unsupportedCharacter.isNull()) {
+ item->_errorString = tr("File names containing the character '%1' are not supported on this file system.")
+ .arg(unsupportedCharacter);
+ } else if (isInvalidPattern) {
item->_errorString = tr("File name contains at least one invalid character");
} else {
item->_errorString = tr("The file name is a reserved name on this file system.");