summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}