зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1778429, use utf-16 character literals when calling ReplaceChar in SanitizeFileName, r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D152669
This commit is contained in:
Родитель
0d435f2bd7
Коммит
5c6bb2989e
|
@ -3504,8 +3504,8 @@ void nsExternalHelperAppService::SanitizeFileName(nsAString& aFileName,
|
|||
nsAutoString fileName(aFileName);
|
||||
|
||||
// Replace known invalid characters.
|
||||
fileName.ReplaceChar(KNOWN_PATH_SEPARATORS, '_');
|
||||
fileName.ReplaceChar(FILE_ILLEGAL_CHARACTERS, ' ');
|
||||
fileName.ReplaceChar(u"" KNOWN_PATH_SEPARATORS, '_');
|
||||
fileName.ReplaceChar(u"" FILE_ILLEGAL_CHARACTERS, ' ');
|
||||
fileName.StripChar(char16_t(0));
|
||||
|
||||
const char16_t *startStr, *endStr;
|
||||
|
|
|
@ -150,4 +150,13 @@ add_task(async function validate_filename_method() {
|
|||
checkFilename(repeatStr + ext, mimeService.VALIDATE_SANITIZE_ONLY),
|
||||
repeatStr.substring(0, 234) + ".long_invalid% ch_ars"
|
||||
);
|
||||
|
||||
Assert.equal(
|
||||
checkFilename("test_テスト_T\x83E\\S\x83T.png", 0),
|
||||
"test_テスト_T E_S T.png"
|
||||
);
|
||||
Assert.equal(
|
||||
checkFilename("test_テスト_T\x83E\\S\x83T.pテ\x83ng", 0),
|
||||
"test_テスト_T E_S T.png"
|
||||
);
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче