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 8f1277da8c.

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

Pick-to: 6.5 6.6
Change-Id: I8f13fc678b40a7a9474a0171c50e3e221dfe85c8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Andrius Štikonas 2023-07-03 23:51:20 +01:00 committed by Thiago Macieira
parent 4b7b5edf26
commit 25b4bd5841

View File

@ -397,9 +397,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;