chrome.downloads.download works in Chrome but fails in FF after recent update.
Categories
(WebExtensions :: Untriaged, defect)
Tracking
(Not tracked)
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.
Comment 1•4 years ago
|
||
Bugbug thinks this bug should belong to this component, but please revert this change in case of error.
Updated•4 years ago
|
Description
•