Skip to content

Commit

Permalink
Bug 1817768 - Filter out illegal file extensions. r=Gijs
Browse files Browse the repository at this point in the history
  • Loading branch information
Molly Howell committed Feb 27, 2023
1 parent 7e59313 commit 4cf1876
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion widget/windows/nsFilePicker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,11 @@ bool 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;
}
Expand Down

0 comments on commit 4cf1876

Please sign in to comment.