fix: errors thrown when url uploads get rejected

This commit is contained in:
Bobby Wibowo 2022-07-25 07:32:39 +07:00
parent 5bab3a495e
commit ec4d54573a
No known key found for this signature in database
GPG Key ID: 51C3A1E1E22D26CF

View File

@ -637,9 +637,11 @@ self.actuallyUploadUrls = async (req, res, user, data = {}) => {
})).catch(async error => {
// Unlink temp files (do not wait)
if (filesData.length) {
Promise.all(filesData.map(async file =>
utils.unlinkFile(file.filename).catch(logger.error)
))
Promise.all(filesData.map(async file => {
if (file.filename) {
utils.unlinkFile(file.filename).catch(logger.error)
}
}))
}
// Re-throw suppressed errors as ClientError, otherwise as-is