aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRahiel Kasim <rahielkasim@gmail.com>2017-11-03 15:57:18 +0100
committerRahiel Kasim <rahielkasim@gmail.com>2017-11-03 15:57:18 +0100
commitc3e0e7eebfa572ee93a681db07761e3e209b04c6 (patch)
treeab010d932533b178465b97196da5b1e55f8ab280
parent2b8e33edf155c81876dc685f88864f34c1b6b142 (diff)
filter out dots at the start of filenames
-rw-r--r--src/archiveror.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/archiveror.js b/src/archiveror.js
index a8238f6..8055f22 100644
--- a/src/archiveror.js
+++ b/src/archiveror.js
@@ -227,10 +227,14 @@ function saveLocal(tab, automatic, path) {
}
function sanitizeFilename(title) {
- // Chrome disallows <>:"/\|?*~ in filenames
+ // Chromium disallows <>:"/\|?*~ in filenames (raises an error in chrome.downloads.download)
let name = title;
let re = /[<>:"/\\|?*~]/g;
name = title.replace(re, "_").trim();
+ // Chromium disallows filenames starting with a .
+ while (name.startsWith(".")) {
+ name = name.slice(1);
+ }
return name;
}