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

Redirected to original image when resizing fails

refs https://github.com/TryGhost/Team/issues/1234

Sharp can occasionally fail resizing, this is usually due the the
underlying libvips library failing. We do not want this to cause an
error however, instead we should just show the original image - as
resizing is an optimisation, rather than a requirement.
This commit is contained in:
Fabien egg O'Carroll 2021-11-29 17:41:47 +02:00
parent 616cd107df
commit c77263f35b

View file

@ -115,7 +115,7 @@ module.exports = function (req, res, next) {
}).then(() => {
next();
}).catch(function (err) {
if (err.code === 'SHARP_INSTALLATION' || err.errorType === 'NoContentError') {
if (err.code === 'SHARP_INSTALLATION' || err.code === 'IMAGE_PROCESSING' || err.errorType === 'NoContentError') {
return redirectToOriginal();
}
next(err);