diff options
author | Jay Berkenbilt <ejb@ql.org> | 2023-12-21 23:14:28 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2023-12-21 23:43:29 +0100 |
commit | 4400ce84eeb204cdcb35950dd8fde094fc249051 (patch) | |
tree | 2a60ae462f22d21b35214a3fdaa4af5d63f8b149 /libqpdf/QPDF_json.cc | |
parent | bb12a7ff8df1582a2cb0583bc463a84f5a736219 (diff) | |
download | qpdf-4400ce84eeb204cdcb35950dd8fde094fc249051.tar.zst |
Add "n:/pdf-name" to qpdf JSON for binary names (fixes #1072)
Diffstat (limited to 'libqpdf/QPDF_json.cc')
-rw-r--r-- | libqpdf/QPDF_json.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libqpdf/QPDF_json.cc b/libqpdf/QPDF_json.cc index f8fd689a..864e1a56 100644 --- a/libqpdf/QPDF_json.cc +++ b/libqpdf/QPDF_json.cc @@ -144,6 +144,12 @@ is_name(std::string const& v) return ((v.length() > 1) && (v.at(0) == '/')); } +static bool +is_pdf_name(std::string const& v) +{ + return ((v.length() > 3) && (v.substr(0, 3) == "n:/")); +} + bool QPDF::test_json_validators() { @@ -740,6 +746,8 @@ QPDF::JSONReactor::makeObject(JSON const& value) result = QPDFObjectHandle::newString(QUtil::hex_decode(str)); } else if (is_name(str_v)) { result = QPDFObjectHandle::newName(str_v); + } else if (is_pdf_name(str_v)) { + result = QPDFObjectHandle::parse(str_v.substr(2)); } else { QTC::TC("qpdf", "QPDF_json unrecognized string value"); error(value.getStart(), "unrecognized string value"); |