Merge pull request #1544 from hedgedoc/fix/stop-swollowing-errors

fix(image-upload): Fix swallowing of errors for filesystem
This commit is contained in:
David Mehren 2021-08-14 20:19:32 +02:00 committed by GitHub
commit 277a2424bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -22,7 +22,7 @@ exports.uploadImage = function (imagePath, callback) {
try {
fs.copyFileSync(imagePath, path.join(config.uploadsPath, fileName))
} catch (e) {
callback(new Error('Error while moving file'), null)
callback(new Error(`Error while moving file: ${e.message}`), null)
return
}
callback(null, (new URL(fileName, config.serverURL + '/uploads/')).href)