mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-25 03:06:31 -05:00
Fix linter errors in imageRouter
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
9e2f9e21e9
commit
0195f16d9a
1 changed files with 7 additions and 7 deletions
|
@ -4,7 +4,7 @@ const Router = require('express').Router
|
||||||
const formidable = require('formidable')
|
const formidable = require('formidable')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const { v4: uuidv4 } = require('uuid');
|
const { v4: uuidv4 } = require('uuid')
|
||||||
const os = require('os')
|
const os = require('os')
|
||||||
const rimraf = require('rimraf')
|
const rimraf = require('rimraf')
|
||||||
const isSvg = require('is-svg')
|
const isSvg = require('is-svg')
|
||||||
|
@ -72,11 +72,11 @@ imageRouter.post('/uploadimage', function (req, res) {
|
||||||
const form = formidable({
|
const form = formidable({
|
||||||
keepExtensions: true,
|
keepExtensions: true,
|
||||||
uploadDir: tmpDir,
|
uploadDir: tmpDir,
|
||||||
filename: function(filename, ext) {
|
filename: function (filename, ext) {
|
||||||
if (typeof ext !== "string") {
|
if (typeof ext !== 'string') {
|
||||||
ext = ".invalid"
|
ext = '.invalid'
|
||||||
}
|
}
|
||||||
return uuidv4() + ext
|
return uuidv4() + ext
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ imageRouter.post('/uploadimage', function (req, res) {
|
||||||
rimraf(tmpDir)
|
rimraf(tmpDir)
|
||||||
return errors.errorForbidden(res)
|
return errors.errorForbidden(res)
|
||||||
} else if (!files.image || !files.image.filepath) {
|
} 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)
|
rimraf.sync(tmpDir)
|
||||||
return errors.errorBadRequest(res)
|
return errors.errorBadRequest(res)
|
||||||
} else if (!(await checkUploadType(files.image.filepath))) {
|
} else if (!(await checkUploadType(files.image.filepath))) {
|
||||||
|
|
Loading…
Reference in a new issue