Fix OGG bug with firefox

pull/1830/head
Chocobozzz 2019-05-21 09:53:03 +02:00
parent 80b8ad2a70
commit 820d79c8ac
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 12 additions and 1 deletions

View File

@ -74,7 +74,18 @@ function createReqFiles (
},
filename: async (req, file, cb) => {
const extension = mimeTypes[ file.mimetype ] || extname(file.originalname)
let extension: string
const fileExtension = extname(file.originalname)
const extensionFromMimetype = mimeTypes[ file.mimetype ]
// Take the file extension if we don't understand the mime type
// We have the OGG/OGV exception too because firefox sends a bad mime type when sending an OGG file
if (fileExtension === '.ogg' || fileExtension === '.ogv' || !extensionFromMimetype) {
extension = fileExtension
} else {
extension = extensionFromMimetype
}
let randomString = ''
try {