summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2023-03-16 17:14:07 +0100
committerMoonchild <moonchild@palemoon.org>2023-03-17 12:02:55 +0100
commitb55f765f2e4bcc5a4aed921b9175f22a2fc7ac6e (patch)
treedc636ca521a866aff3e27cee18136cd2de597a0f
parent856078d43583fd18bd725ff69e0263b6f153f793 (diff)
downloaduxp-RC_20230317.tar.gz
Issue #1911 - Follow-up: Filter out illegal file extensions also.RC_20230317
We already did this for file names, just not extensions.
-rw-r--r--widget/windows/nsFilePicker.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/widget/windows/nsFilePicker.cpp b/widget/windows/nsFilePicker.cpp
index 3d733fcb7f..101eac6922 100644
--- a/widget/windows/nsFilePicker.cpp
+++ b/widget/windows/nsFilePicker.cpp
@@ -355,7 +355,11 @@ nsFilePicker::ShowFilePicker(const nsString& aInitialDir)
// default extension to append to new files
if (!mDefaultExtension.IsEmpty()) {
- hr = dialog->SetDefaultExtension(mDefaultExtension.get());
+ // We don't want environment variables expanded in the extension either.
+ nsAutoString sanitizedExtension(mDefaultExtension);
+ sanitizedExtension.ReplaceChar('%', '_');
+
+ hr = dialog->SetDefaultExtension(sanitizedExtension.get());
if (FAILED(hr)) {
return false;
}