Open Bug 1819643 Opened 3 years ago Updated 3 years ago

downloads.download should report accurate error for clearly invalid filenames

Categories

(WebExtensions :: General, enhancement, P5)

enhancement

Tracking

(Not tracked)

People

(Reporter: robwu, Unassigned)

References

Details

This is a follow-up to https://bugzilla.mozilla.org/show_bug.cgi?id=1810793#c40 . The test case in that comment triggers "Error: filename must not contain illegal characters", even though the more correct error would be something like "Invalid filename" (if an error were to be reported at all - bug 1791530).

Here is a different test case that fails to report the correct error.
STR:

  1. Load an extension with the "downloads" permission, and run the following snippet:
chrome.downloads.download({
  url: URL.createObjectURL(new Blob(["x"])),
  filename: "dir/isthisadir/",
  saveAs: false,
});

Expected:

  • Should throw an error about the filename being invalid. E.g. Chrome does not download and the error "Invalid filename" is logged.

Actual:

  • with saveAs: false,: directory dir/isthisadir is created, and a file is saved at dir/isthisadir(1)
  • with saveAs: false,: directory dir/isthisadir is created, and the file picker proposes a file called "isthisadir(1)" within that new directory.
Severity: -- → N/A
Priority: -- → P5
You need to log in before you can comment on or make changes to this bug.