0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -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 committed by Fabien 'egg' O'Carroll
parent 54b537deba
commit 0b973d1f29

View file

@ -115,7 +115,7 @@ module.exports = function (req, res, next) {
}).then(() => { }).then(() => {
next(); next();
}).catch(function (err) { }).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(); return redirectToOriginal();
} }
next(err); next(err);