Closed Bug 1638226 Opened 4 years ago Closed 4 years ago

chrome.downloads.download works in Chrome but fails in FF after recent update.

Categories

(WebExtensions :: Untriaged, defect)

76 Branch
defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1637973

People

(Reporter: bugzilla, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; rv:76.0) Gecko/20100101 Firefox/76.0

Steps to reproduce:

This code, in my web-extension background script works fine in Google Chrome for same filenames but not in Firefox, this started happening after recent FF upgrade:

chrome.runtime.onMessage.addListener(function (message) {
var url = message.url;
var fname = message.filename;
fname = fname.replace(/[\/:"*?<>|\r\n]+/g, "_");

chrome.downloads.download({
	url: url,
	filename: fname,
	conflictAction: 'uniquify',
	saveAs: true
});

});

Actual results:

Unchecked lastError value: Error: filename must not contain illegal characters

Expected results:

File should download without said error in console. I debugged the issue and found any filename having consecutive spaces will fail, using .replace(/\s+/g,' '); fixes the issue.

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Product: Firefox → WebExtensions
Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.