only files have attrs
This commit is contained in:
parent
879add5038
commit
4ea4cfb025
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue