summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSheogorath2020-11-23 13:59:50 +0100
committerDavid Mehren2020-12-27 19:51:02 +0100
commitf83e4d66ed2b6a7f7f8939e2eb63d262387e9374 (patch)
tree78c012c4439a1c9a71d5ad920727b4913dd48384
parentd097211c545118ac13626e1b0a01390b08880ad7 (diff)
Rework error messages for image uploads
This patch reworks the error messages for image uploads to make more sense. Instead of using the current `formidable error` for everything, all custom error detection now provide the (hopefully) more useful `Image Upload error` prefix for error messages. Signed-off-by: Christoph Kern <sheogorath@shivering-isles.com>
Diffstat (limited to '')
-rw-r--r--lib/web/imageRouter/index.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/web/imageRouter/index.js b/lib/web/imageRouter/index.js
index f456fd30..b6ace4a6 100644
--- a/lib/web/imageRouter/index.js
+++ b/lib/web/imageRouter/index.js
@@ -21,16 +21,16 @@ imageRouter.post('/uploadimage', function (req, res) {
form.parse(req, function (err, fields, files) {
if (err) {
- logger.error(`formidable error: ${err}`)
+ logger.error(`Image upload error: formidable error: ${err}`)
return errors.errorForbidden(res)
} else if (!req.isAuthenticated() && !config.allowAnonymous && !config.allowAnonymousEdits) {
- logger.error(`formidable error: Anonymous edits and therefore uploads are not allowed)`)
+ logger.error(`Image upload error: Anonymous edits and therefore uploads are not allowed)`)
return errors.errorForbidden(res)
} else if (!files.image || !files.image.path) {
- logger.error(`formidable error: Upload didn't contain file)`)
+ logger.error(`Image upload error: Upload didn't contain file)`)
return errors.errorBadRequest(res)
} else if (!config.allowedUploadMimeTypes.includes(files.image.type)) {
- logger.error(`formidable error: MIME-type "${files.image.type}" of uploaded file not allowed, only "${config.allowedUploadMimeTypes.join(', ')}" are allowed)`)
+ logger.error(`Image upload error: MIME-type "${files.image.type}" of uploaded file not allowed, only "${config.allowedUploadMimeTypes.join(', ')}" are allowed)`)
return errors.errorBadRequest(res)
} else {
logger.debug(`SERVER received uploadimage: ${JSON.stringify(files.image)}`)