only files have attrs

This commit is contained in:
Nadav Ivgi 2017-12-17 20:01:51 +02:00
parent 879add5038
commit 4ea4cfb025
1 changed files with 2 additions and 2 deletions

View File

@ -25,11 +25,11 @@ module.exports = (base, default_price, invoice_ttl, files_attr) => {
if (/^\.\.\//.test(relpath) || reIgnore.test(name)) throw new Error('forbidden')
const file = { fullpath, path: relpath, urlpath: escape(relpath), name, ext, dirname, attr }
const file = { fullpath, path: relpath, urlpath: escape(relpath), name, ext, dirname }
, stat = await fs.stat(fullpath)
return stat.isDirectory() ? { ...file, type: 'dir', files: !shallow && await listFiles(fullpath) }
: stat.isFile() ? { ...file, type: 'file', size: stat.size, price: attr.price || default_price
: stat.isFile() ? { ...file, type: 'file', size: stat.size, attr, price: attr.price || default_price
, mime: await getMime(file), exif: !shallow && await getExif(fullpath) }
: null
}