Merge pull request #14572 from Snuffleupagus/_collectJS-string-check
Add a missing string-check in the `_collectJS` helper function
This commit is contained in:
commit
ff6d9c74cc
@ -22,7 +22,8 @@ import {
|
||||
stringToPDFString,
|
||||
warn,
|
||||
} from "../shared/util.js";
|
||||
import { Dict, isName, isRef, isStream, RefSet } from "./primitives.js";
|
||||
import { Dict, isName, isRef, RefSet } from "./primitives.js";
|
||||
import { BaseStream } from "./base_stream.js";
|
||||
|
||||
function getLookupTableFactory(initializer) {
|
||||
let lookup;
|
||||
@ -329,15 +330,15 @@ function _collectJS(entry, xref, list, parents) {
|
||||
_collectJS(element, xref, list, parents);
|
||||
}
|
||||
} else if (entry instanceof Dict) {
|
||||
if (isName(entry.get("S"), "JavaScript") && entry.has("JS")) {
|
||||
if (isName(entry.get("S"), "JavaScript")) {
|
||||
const js = entry.get("JS");
|
||||
let code;
|
||||
if (isStream(js)) {
|
||||
if (js instanceof BaseStream) {
|
||||
code = js.getString();
|
||||
} else {
|
||||
} else if (typeof js === "string") {
|
||||
code = js;
|
||||
}
|
||||
code = stringToPDFString(code);
|
||||
code = code && stringToPDFString(code);
|
||||
if (code) {
|
||||
list.push(code);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user