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 78505f86ef
commit a4464d0137

View File

@ -123,6 +123,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}));
}