For this file-name Yemin 245. Bölüm.mp4
having UTF characters the following code in my web-extension works fine in Google Chrome
and the file gets downloaded (EDIT: No matter what filename I use this is resulting in error, it seems some update in Firefox broke this). But, firefox
fails with error Unchecked lastError value: Error: filename must not contain illegal characters
:
In background.js
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
});
});
What am I missing here?