Skip to content

Commit

Permalink
Merge pull request #29 from hufan-akari/patch-2
Browse files Browse the repository at this point in the history
Update downloadAble.js
  • Loading branch information
miniers authored Feb 26, 2018
2 parents b73f810 + 1cc10fc commit 7d59443
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/public/downloadAble.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ export default function downloadAble(url, config = {}, keypress = {}) {
if(keypress.isShiftPressd){
return true
}

// 如果 pathname 没有".",提前返回false
if(!pathname.includes(".")){
return false;
}

//判断 pathname 中文件后缀是否在配置内
const pathname_lowercase = pathname.toLowerCase();
Expand All @@ -30,7 +35,7 @@ export default function downloadAble(url, config = {}, keypress = {}) {
.toLowerCase()
.split(/\s+/)
.map(filetype => "." + filetype)
.some(ext => pathname_lowercase.endswith(ext))
.some(ext => pathname_lowercase.endsWith(ext))
: false;
}

Expand Down

0 comments on commit 7d59443

Please sign in to comment.