mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-25 03:06:31 -05:00
fix(image-upload): Fix swallowing of errors for filesystem
This patch fixes the swollowing of the actual error message that appears when a file fails to move, after being uploaded to Hedgedoc on an instance that is using the upload-method `filesystem` active. This became apparent when the error messages provided by some users, where less than helpful. As a solution the error message of the copy command was added to the error that is output to the console. https://community.hedgedoc.org/t/image-upload-fail-docker/439 Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
This commit is contained in:
parent
6c17823da1
commit
c025d6abee
1 changed files with 1 additions and 1 deletions
|
@ -22,7 +22,7 @@ exports.uploadImage = function (imagePath, callback) {
|
||||||
try {
|
try {
|
||||||
fs.copyFileSync(imagePath, path.join(config.uploadsPath, fileName))
|
fs.copyFileSync(imagePath, path.join(config.uploadsPath, fileName))
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
callback(new Error('Error while moving file'), null)
|
callback(new Error(`Error while moving file: ${e.message}`), null)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
callback(null, (new URL(fileName, config.serverURL + '/uploads/')).href)
|
callback(null, (new URL(fileName, config.serverURL + '/uploads/')).href)
|
||||||
|
|
Loading…
Reference in a new issue