gyng / save-in

WebExtension for saving media, links, or selections into user-defined directories
MIT License
205 stars 25 forks source link

Sanitize filename #74

Open def00111 opened 6 years ago

def00111 commented 6 years ago

You can look what mozilla is doing here: https://searchfox.org/mozilla-central/rev/9a3f8590f807d449e790c8ba0e39eb14f41066d8/toolkit/components/downloads/DownloadPaths.jsm#68

gyng commented 6 years ago

Thanks! I was aware of it, but hadn't thought of using theirs. There are considerations for platform differences (not so much Chrome compatibility as it's sanitized before hitting the extension), so it's not a straightforward copy and paste job. I've tried to be as broad and safe as possible when sanitizing filenames, so if you anyone has examples of downloads failing because of bad filenames please share them.

I'll take a closer look at what Firefox is doing once I get some time to sit down with it.