QStorageInfo: Correctly decode backslash in file system labels

At the moment labels such as "one\two" are incorrectly
decoded as "one\x5ctwo".

Backslashes were originally excluded after Thiago Maciera's review,
see commit 8f1277da8c137270ff857128d8fea1423d8a7700.

Now Thiago agrees that original reasoning for excluding backslash
was incorrect and we do want to decode them.

Change-Id: I8f13fc678b40a7a9474a0171c50e3e221dfe85c8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 25b4bd5841401119c90f2ac1d49b74f2415ec40f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Andrius Štikonas 2023-07-03 23:51:20 +01:00 committed by Qt Cherry-pick Bot
parent dacc75de29
commit 23982baf56

View File

@ -742,9 +742,7 @@ static QString decodeFsEncString(const QString &str)
if (QStringView{str}.sliced(i).startsWith("\\x"_L1)) { if (QStringView{str}.sliced(i).startsWith("\\x"_L1)) {
bool bOk; bool bOk;
const int code = QStringView{str}.mid(i+2, 2).toInt(&bOk, 16); const int code = QStringView{str}.mid(i+2, 2).toInt(&bOk, 16);
// only decode characters between 0x20 and 0x7f but not if (bOk && code >= 0x20 && code < 0x80) {
// the backslash to prevent collisions
if (bOk && code >= 0x20 && code < 0x80 && code != '\\') {
decoded += QChar(code); decoded += QChar(code);
i += 4; i += 4;
continue; continue;