Merge pull request #14628 from Snuffleupagus/issue-14626

When `stopAtErrors` is set, throw rather than warn when exceeding `maxImageSize` (issue 14626)
This commit is contained in:
Tim van der Meij 2022-03-05 13:09:36 +01:00 committed by GitHub
commit 5242c38af5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -576,8 +576,13 @@ class PartialEvaluator {
}
const maxImageSize = this.options.maxImageSize;
if (maxImageSize !== -1 && w * h > maxImageSize) {
warn("Image exceeded maximum allowed size and was removed.");
return;
const msg = "Image exceeded maximum allowed size and was removed.";
if (this.options.ignoreErrors) {
warn(msg);
return;
}
throw new Error(msg);
}
let optionalContent;