u
This commit is contained in:
parent
36f69291f0
commit
fcaf990c51
@ -400,11 +400,10 @@ module.exports = {
|
||||
get_file_ext (filename = '') {
|
||||
const parts = filename.split('.')
|
||||
// 注意,'abc'.split('.') === ['abc']
|
||||
let ext = ''
|
||||
if (parts.length >= 2) {
|
||||
ext = parts.pop().toLowerCase()
|
||||
return parts.pop().toLowerCase()
|
||||
}
|
||||
return ext
|
||||
return ''
|
||||
|
||||
// 如果用 path.extname:
|
||||
// if (/^\./.test(filename)) filename = `added$filename` // path.extname('.abc') 结果为 '',所以要添加前缀
|
||||
|
Loading…
Reference in New Issue
Block a user