Fix linter errors in imageRouter

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2022-04-10 21:16:35 +02:00
parent 9e2f9e21e9
commit 0195f16d9a
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3

View file

@ -4,7 +4,7 @@ const Router = require('express').Router
const formidable = require('formidable')
const path = require('path')
const fs = require('fs')
const { v4: uuidv4 } = require('uuid');
const { v4: uuidv4 } = require('uuid')
const os = require('os')
const rimraf = require('rimraf')
const isSvg = require('is-svg')
@ -72,11 +72,11 @@ imageRouter.post('/uploadimage', function (req, res) {
const form = formidable({
keepExtensions: true,
uploadDir: tmpDir,
filename: function(filename, ext) {
if (typeof ext !== "string") {
ext = ".invalid"
}
return uuidv4() + ext
filename: function (filename, ext) {
if (typeof ext !== 'string') {
ext = '.invalid'
}
return uuidv4() + ext
}
})
@ -86,7 +86,7 @@ imageRouter.post('/uploadimage', function (req, res) {
rimraf(tmpDir)
return errors.errorForbidden(res)
} else if (!files.image || !files.image.filepath) {
logger.error("Image upload error: Upload didn't contain file)")
logger.error('Image upload error: Upload didn\'t contain file)')
rimraf.sync(tmpDir)
return errors.errorBadRequest(res)
} else if (!(await checkUploadType(files.image.filepath))) {