0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00

Return correct error codes from storage adapter

no issue

- malformed paths such as http://localhost:2368/content/images/2018/02/%c0%af were throwing 500 errors, instead of 500 errors
- this code catches the error and handles it correctly
This commit is contained in:
Hannah Wolfe 2019-09-06 17:40:55 +01:00
parent 81f6b3df1e
commit 03f31bba9d

View file

@ -99,6 +99,14 @@ class LocalFileStore extends StorageBase {
}));
}
if (err.statusCode === 400) {
return next(new common.errors.BadRequestError({err: err}));
}
if (err.statusCode === 403) {
return next(new common.errors.NoPermissionError({err: err}));
}
return next(new common.errors.GhostError({err: err}));
}