https://github.com/brave/browser-laptop/pull/11906#issue-273121960
I have a user report from support that file extensions are not being added for downloaded files. The user says they have to guess the file extension so the file gets saved.
Actually extensions are added automatically when downloading, but they are cleared if you change the file name of it.
STR:
I think this is a windows-only issue.
+1
This issue is indeed limited to Windows, and also affects the _Save As鈥 options.
I suspect the issue here is with the prompt receiving little more than a filename (source).
void WebContents::DownloadURL(const GURL& url, bool prompt_for_location) {
auto browser_context = web_contents()->GetBrowserContext();
auto download_manager = content::BrowserContext::GetDownloadManager(browser_context);
auto params = content::DownloadUrlParameters::CreateForWebContentsMainFrame(web_contents(), url);
if (prompt_for_location)
params->set_prompt(prompt_for_location);
download_manager->DownloadUrl(std::move(params));
}
In Brave, this results in a _All Files_ dialog, whereas Chrome filters on the extension. Note the different values for _Save as type_ in both of the screenshots below.


If you replace the filename in Brave, you have no way of telling what the proper extension ought to be. In Chrome, the extension will be enforced by the _Save as type_ option, even if the new filename lacks an extension.
macOS pre-selects the filename up to, but not including, the extension. This reduces the likelihood that the user will unintentionally mess up the extension.

A showSaveDialog method is defined in Electron, and preserved in Muon, that we might prefer. This method accepts a filters argument, allowing the _Save As_ dialog to focus exclusively on particular file types. Presumably, this is more than just a way to filter what is shown, but to enforce what can be saved.
Adding this to 0.20.x under the assumption that it's fairly straight-forward to use an alternative approach that supports explicit filter lists. If this isn't as straight-forward, please feel free to bump to another milestone.
When investigating this, it might be good to check this out: https://github.com/electron/electron/issues/10121 (fixed with https://github.com/electron/electron/pull/10469/files)
@zentagonist Is this not a proper STR? https://github.com/brave/browser-laptop/issues/1985#issuecomment-250883580
@bsclifton , the long term solution will be this https://github.com/brave/muon/issues/242
And I made some progress on it.
+1 from Twitter: https://twitter.com/meta_gear/status/945817220944363522:
_@brave Why does the browser not save files with their proper extensions? When I save an image it's just a generic file, not a .jpg or .png or whatever_
Will be fixed by https://github.com/brave/browser-laptop/pull/11906
@darkdh I was just checking out that PR :) Any idea when that will be merged?
It requires https://github.com/brave/muon/pull/385 to be merged first. Muon PR is currently under reviewed
+1 from Twitter https://twitter.com/emacosc/status/953217720878796800
+1 from @bravefan via https://github.com/brave/browser-laptop/issues/12878
Blocked on #13230 #13228
Moving to 0.22.x; we're going to have 0.21.x-C65 only contain the Chromium upgrade 馃槃 馃憤