When stopAtErrors is set, throw rather than warn when exceeding maxImageSize (issue 14626)

The situation described in issue 14626 seems like a fairly special case, and it thus seem reasonable that we simply follow the same pattern as elsewhere in the `PartialEvaluator` when the `stopAtErrors` API-option is being used.
This commit is contained in:
Jonas Jenwald 2022-03-03 13:04:42 +01:00
parent 234aa9a50e
commit d0d5c596fb

View File

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