NaturalBase
2 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
2 additions and
1 deletions
-
server/controllers/upload.js
|
|
@ -76,7 +76,8 @@ router.post('/u', (req, res, next) => { |
|
|
|
} |
|
|
|
|
|
|
|
// Sanitize filename
|
|
|
|
fileMeta.originalname = sanitize(fileMeta.originalname.toLowerCase().replace(/[\s,;#]+/g, '_')) |
|
|
|
let time = new Date().getTime() |
|
|
|
fileMeta.originalname = req.user.name + "_" + time + "_" + sanitize(fileMeta.originalname.toLowerCase().replace(/[\s,;#]+/g, '_')) |
|
|
|
|
|
|
|
// Check if user can upload at path
|
|
|
|
const assetPath = (folderId) ? hierarchy.map(h => h.slug).join('/') + `/${fileMeta.originalname}` : fileMeta.originalname |
|
|
|