0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Handle content requests with overly long filenames

no issue

- a request for a filename longer than those allowed by the filesystem produced a ENAMETOOLONG error, which would end up becoming a 500 error from Ghost
- this catches the error and returns a HTTP 400 Bad Request response
This commit is contained in:
Daniel Lockyer 2020-01-16 14:18:09 +07:00
parent e9e3f58792
commit a671ad4707

View file

@ -171,6 +171,10 @@ class LocalFileStore extends StorageBase {
})); }));
} }
if (err.code === 'ENAMETOOLONG') {
return reject(new common.errors.BadRequestError({err: err}));
}
return reject(new common.errors.GhostError({ return reject(new common.errors.GhostError({
err: err, err: err,
message: common.i18n.t('errors.errors.cannotReadImage', {img: options.path}) message: common.i18n.t('errors.errors.cannotReadImage', {img: options.path})