mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-16 04:07:02 +00:00
Remove some more symbols from filenames.
This commit is contained in:
parent
0f775e1e66
commit
bc171f625a
@ -432,15 +432,26 @@ void DocumentData::setattributes(const QVector<MTPDocumentAttribute> &attributes
|
|||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case mtpc_documentAttributeFilename: {
|
case mtpc_documentAttributeFilename: {
|
||||||
auto &attribute = attributes[i];
|
const auto &attribute = attributes[i];
|
||||||
auto remoteFileName = qs(
|
_filename = qs(
|
||||||
attribute.c_documentAttributeFilename().vfile_name);
|
attribute.c_documentAttributeFilename().vfile_name);
|
||||||
|
|
||||||
// We don't want RTL Override characters in filenames,
|
// We don't want LTR/RTL mark/embedding/override/isolate chars
|
||||||
// because they introduce a security issue, when a filename
|
// in filenames, because they introduce a security issue, when
|
||||||
// "Fil[RTLO]gepj.exe" looks like "Filexe.jpeg" being ".exe"
|
// an executable "Fil[x]gepj.exe" may look like "Filexe.jpeg".
|
||||||
auto rtlOverride = QChar(0x202E);
|
QChar controls[] = {
|
||||||
_filename = std::move(remoteFileName).replace(rtlOverride, "");
|
0x200E, // LTR Mark
|
||||||
|
0x200F, // RTL Mark
|
||||||
|
0x202A, // LTR Embedding
|
||||||
|
0x202B, // RTL Embedding
|
||||||
|
0x202D, // LTR Override
|
||||||
|
0x202E, // RTL Override
|
||||||
|
0x2066, // LTR Isolate
|
||||||
|
0x2067, // RTL Isolate
|
||||||
|
};
|
||||||
|
for (const auto ch : controls) {
|
||||||
|
_filename = std::move(_filename).replace(ch, "_");
|
||||||
|
}
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user