mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-01-19 01:31:34 +00:00
Updated uploadController.js
Fixed a bug where error messages related to multer would not be displayed properly (it would instead print "undefined").
This commit is contained in:
parent
616da886f7
commit
917afdf7a8
@ -63,7 +63,7 @@ const upload = multer({
|
|||||||
const extname = path.extname(file.originalname).toLowerCase()
|
const extname = path.extname(file.originalname).toLowerCase()
|
||||||
if (uploadsController.isExtensionFiltered(extname)) {
|
if (uploadsController.isExtensionFiltered(extname)) {
|
||||||
// eslint-disable-next-line standard/no-callback-literal
|
// eslint-disable-next-line standard/no-callback-literal
|
||||||
cb(`${extname.substr(1).toUpperCase()} files are not permitted for security reasons.`)
|
return cb(`${extname.substr(1).toUpperCase()} files are not permitted for security reasons.`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Re-map Dropzone keys so people can manually use the API without prepending 'dz'
|
// Re-map Dropzone keys so people can manually use the API without prepending 'dz'
|
||||||
@ -163,7 +163,7 @@ uploadsController.actuallyUpload = async (req, res, user, albumid) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
upload(req, res, async error => {
|
upload(req, res, async error => {
|
||||||
if (error) { return erred(error.message) }
|
if (error) { return erred(error) }
|
||||||
|
|
||||||
if (!req.files || !req.files.length) { return erred('No files.') }
|
if (!req.files || !req.files.length) { return erred('No files.') }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user