Skip to content

Commit

Permalink
Fix link/media detection, strip bad characters from filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
gyng committed Apr 20, 2017
1 parent c8c5ae5 commit 78f6347
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ browser.contextMenus.onClicked.addListener((info) => {

if (matchSave && matchSave.length === 2) {
const path = matchSave[1];
const url = MEDIA_TYPES.includes('info.mediaType') ? info.srcUrl : info.linkUrl;
const filename = url.substring(url.lastIndexOf('/') + 1);
const url = MEDIA_TYPES.includes(info.mediaType) ? info.srcUrl : info.linkUrl;
const filename = url.substring(url.lastIndexOf('/') + 1).replace(/[|&;$%@"<>()+,]/g, '');

browser.downloads.download({
url,
Expand Down

0 comments on commit 78f6347

Please sign in to comment.