mobi ios workaround, improve style up recieve page

This commit is contained in:
daniel-j
2023-12-06 15:00:41 +01:00
parent 78e5d79ca8
commit 77173960ca
4 changed files with 98 additions and 27 deletions

View File

@@ -97,7 +97,7 @@ const upload = multer({
cb(null, false)
return
}
if (!allowedTypes.includes(file.mimetype) || !allowedExtensions.includes(extname(file.originalname.toLowerCase()).substr(1))) {
if (!allowedTypes.includes(file.mimetype) || !allowedExtensions.includes(extname(file.originalname.toLowerCase()).substring(1))) {
console.error('FileFilter: File is of an invalid type ', file)
cb(null, false)
return
@@ -198,7 +198,7 @@ router.post('/upload', upload.single('file'), async ctx => {
const type = await FileType.fromFile(ctx.request.file.path)
if (!type || !allowedTypes.includes(type.mime)) {
if ((!type || !allowedTypes.includes(type.mime)) && !allowedTypes.includes(mimetype)) {
flash(ctx, {
message: 'Uploaded file is of an invalid type: ' + ctx.request.file.originalname + ' (' + (type? type.mime : 'unknown mimetype') + ')',
success: false,