diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 03:41:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 03:41:35 +0000 |
commit | 2d861407bd7e9cc56fba8f2f763fe62dddb4da81 (patch) | |
tree | 32d9a69e31440af23173f321c975471ca10608c0 /uriloader/exthandler/nsExternalHelperAppService.cpp | |
parent | Releasing progress-linux version 115.11.0esr-1~progress7.99u1. (diff) | |
download | firefox-esr-2d861407bd7e9cc56fba8f2f763fe62dddb4da81.tar.xz firefox-esr-2d861407bd7e9cc56fba8f2f763fe62dddb4da81.zip |
Merging upstream version 115.12.0esr.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'uriloader/exthandler/nsExternalHelperAppService.cpp')
-rw-r--r-- | uriloader/exthandler/nsExternalHelperAppService.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp index 84dc262561..3577ff2bbf 100644 --- a/uriloader/exthandler/nsExternalHelperAppService.cpp +++ b/uriloader/exthandler/nsExternalHelperAppService.cpp @@ -3491,8 +3491,8 @@ void nsExternalHelperAppService::SanitizeFileName(nsAString& aFileName, nsAutoString fileName(aFileName); // Replace known invalid characters. - fileName.ReplaceChar(u"" KNOWN_PATH_SEPARATORS, u'_'); - fileName.ReplaceChar(u"" FILE_ILLEGAL_CHARACTERS, u' '); + fileName.ReplaceChar(u"" KNOWN_PATH_SEPARATORS FILE_ILLEGAL_CHARACTERS "%", + u'_'); fileName.StripChar(char16_t(0)); const char16_t *startStr, *endStr; @@ -3674,6 +3674,14 @@ void nsExternalHelperAppService::SanitizeFileName(nsAString& aFileName, outFileName.Truncate(lastNonTrimmable); } + nsAutoString extension; + int32_t dotidx = outFileName.RFind(u"."); + if (dotidx != -1) { + extension = Substring(outFileName, dotidx + 1); + extension.StripWhitespace(); + outFileName = Substring(outFileName, 0, dotidx + 1) + extension; + } + #ifdef XP_WIN if (nsLocalFile::CheckForReservedFileName(outFileName)) { outFileName.Truncate(); |