rename user 'uuid' to 'usid'

This commit is contained in:
陆柯 2022-09-11 20:39:08 +08:00
parent ce883f0d03
commit f08e8f48ac

View File

@ -16,7 +16,7 @@ module.exports = {
const fileNameExtension = path.extname(file.originalname) const fileNameExtension = path.extname(file.originalname)
const filename = `${Date.now()}_${crypto.randomBytes(16).toString('hex')}${fileNameExtension}` const filename = `${Date.now()}_${crypto.randomBytes(16).toString('hex')}${fileNameExtension}`
//const _passtokenSource = webtoken.verifyToken(req.headers._passtoken) || {} //const _passtokenSource = webtoken.verifyToken(req.headers._passtoken) || {}
//const filename = `${req.path.replace(/^\/api\d*/, '')}_${_passtokenSource.uuid}_${Date.now()}${fileNameExtension}` // 如果最终 filename 含有 / (例如当 req.path 为 Who/todo则必须已经存在该目录否则在这里就出错不会进入下面流程。 //const filename = `${req.path.replace(/^\/api\d*/, '')}_${_passtokenSource.usid}_${Date.now()}${fileNameExtension}` // 如果最终 filename 含有 / (例如当 req.path 为 Who/todo则必须已经存在该目录否则在这里就出错不会进入下面流程。
cb(null, filename) cb(null, filename)
}, },
// req 被 multer 处理后req.file 为 { destination, filename, originialname, path, mimetype, size }, 其中 path 包括了 destination 和 filename 的文件完整路径。 // req 被 multer 处理后req.file 为 { destination, filename, originialname, path, mimetype, size }, 其中 path 包括了 destination 和 filename 的文件完整路径。