summaryrefslogtreecommitdiff
path: root/widget
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2023-03-16 17:14:07 +0100
committerMoonchild <moonchild@palemoon.org>2023-03-16 17:14:07 +0100
commit947768348186fb8613cc2dce1cfd85aa26a52d11 (patch)
tree5693dedc183be9b975191bab7f8b85c01e701b51 /widget
parent465a18f34286f8d7e0c9b5f0722d487b4812fb57 (diff)
downloaduxp-947768348186fb8613cc2dce1cfd85aa26a52d11.tar.gz
Issue #1911 - Follow-up: Filter out illegal file extensions also.
We already did this for file names, just not extensions.
Diffstat (limited to 'widget')
-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;
}