fix: url uploads failing with missing content-type

This commit is contained in:
Bobby 2022-05-08 15:15:10 +07:00
parent 851eaacd8e
commit 71a6adc3d3
No known key found for this signature in database
GPG Key ID: 941839794CBF5A09
1 changed files with 3 additions and 1 deletions

View File

@ -442,13 +442,15 @@ self.actuallyUploadUrls = async (req, res, user, albumid, age) => {
throw new ServerError(`${fetchFile.status} ${fetchFile.statusText}`)
}
const contentType = fetchFile.headers.get('content-type')
infoMap.push({
path: destination,
data: {
filename: name,
originalname: original,
extname,
mimetype: fetchFile.headers.get('content-type').split(';')[0] || '',
mimetype: contentType ? contentType.split(';')[0] : '',
size: outStream.bytesWritten,
hash: hash.digest('hex'),
albumid,