use regex for directory check

This commit is contained in:
Brian Gough 2017-10-16 15:17:33 +01:00
parent 2bb7c6d4c6
commit 4c78b5770c

View file

@ -39,7 +39,8 @@ module.exports = ArchiveManager =
_checkFilePath: (entry, destination, callback = (err, destFile) ->) ->
# check if the entry is a directory
if /\/$/.test(entry.fileName)
endsWithSlash = /\/$/
if endsWithSlash.test(entry.fileName)
return callback() # don't give a destfile for directory
# check that the file does not use a relative path
for dir in entry.fileName.split('/')