Bug 1791530 Comment 7 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

I see a potential resolution here that does not require API changes nor changes in extensions.

The `downloads.download` API has the `conflictAction` parameter that [is documented](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/downloads/FilenameConflictAction) have the following values:

- "uniquify" - The browser will modify the filename to make it unique.
- "overwrite" - The browser will overwrite the old file with the newly-downloaded file.
- "prompt" - The browser will prompt the user, asking them to choose whether to uniquify or overwrite. ([not implemented in Firefox](https://searchfox.org/mozilla-central/rev/a2d875255c67e39b28d59a0996e8b54fa2d7564e/toolkit/components/extensions/parent/ext-downloads.js#705-710))

The default `conflictAction` is "uniquify", which could be interpreted as the extension not caring about the specific name, as long as it is somewhat reasonable.

We could continue to strictly enforce the validation when `conflictAction` is "prompt" but try to more liberally interpret "uniquify" as approval to mangle the filename to something else.
I see a potential resolution here that does not require API changes nor changes in extensions.

The `downloads.download` API has the `conflictAction` parameter that [is documented](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/downloads/FilenameConflictAction) have the following values:

- "uniquify" - The browser will modify the filename to make it unique.
- "overwrite" - The browser will overwrite the old file with the newly-downloaded file.
- "prompt" - The browser will prompt the user, asking them to choose whether to uniquify or overwrite. ([not implemented in Firefox](https://searchfox.org/mozilla-central/rev/a2d875255c67e39b28d59a0996e8b54fa2d7564e/toolkit/components/extensions/parent/ext-downloads.js#705-710))

The default `conflictAction` is "uniquify", which could be interpreted as the extension not caring about the specific name, as long as it is somewhat reasonable.

We could continue to strictly enforce the validation when `conflictAction` is "prompt" but try to more liberally interpret "uniquify" as approval to mangle the filename to something else.

P.S. For comparison, Chrome's default behavior is already to mangle file names (independently of the conflictAction parameter).

Back to Bug 1791530 Comment 7