mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-08-02 04:17:24 +02:00
Merge pull request #21481 from Snuffleupagus/metadata-isDict
Use the `isDict` helper in the `Catalog.prototype.metadata` getter
This commit is contained in:
commit
38daede697
@ -279,11 +279,11 @@ class Catalog {
|
|||||||
/* suppressEncryption = */ !this.xref.encrypt?.encryptMetadata
|
/* suppressEncryption = */ !this.xref.encrypt?.encryptMetadata
|
||||||
);
|
);
|
||||||
|
|
||||||
if (stream instanceof BaseStream && stream.dict instanceof Dict) {
|
if (
|
||||||
const type = stream.dict.get("Type");
|
stream instanceof BaseStream &&
|
||||||
const subtype = stream.dict.get("Subtype");
|
isDict(stream.dict, "Metadata") &&
|
||||||
|
isName(stream.dict.get("Subtype"), "XML")
|
||||||
if (isName(type, "Metadata") && isName(subtype, "XML")) {
|
) {
|
||||||
// XXX: This should examine the charset the XML document defines,
|
// XXX: This should examine the charset the XML document defines,
|
||||||
// however since there are currently no real means to decode arbitrary
|
// however since there are currently no real means to decode arbitrary
|
||||||
// charsets, let's just hope that the author of the PDF was reasonable
|
// charsets, let's just hope that the author of the PDF was reasonable
|
||||||
@ -293,7 +293,6 @@ class Catalog {
|
|||||||
metadata = new MetadataParser(data).serializable;
|
metadata = new MetadataParser(data).serializable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
if (ex instanceof MissingDataException) {
|
if (ex instanceof MissingDataException) {
|
||||||
throw ex;
|
throw ex;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user