aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-04-24 18:47:24 +0200
committerJay Berkenbilt <ejb@ql.org>2022-04-24 19:06:19 +0200
commitd0b7cc8ac6773e3ddab1c34da910072fac441d07 (patch)
tree1c31fdd532e5b279a0b8079dbefb1f6cfd55dc26 /libqpdf
parent63c5a56f38f51c4e1f0226721eae59a9201fed0e (diff)
downloadqpdf-d0b7cc8ac6773e3ddab1c34da910072fac441d07.tar.zst
QPDFJob json: make removeAttachment take an array (fixes #693)
Diffstat (limited to 'libqpdf')
-rw-r--r--libqpdf/QPDFJob_json.cc11
-rw-r--r--libqpdf/qpdf/auto_job_json_decl.hh2
-rw-r--r--libqpdf/qpdf/auto_job_json_init.hh2
-rw-r--r--libqpdf/qpdf/auto_job_schema.hh4
4 files changed, 18 insertions, 1 deletions
diff --git a/libqpdf/QPDFJob_json.cc b/libqpdf/QPDFJob_json.cc
index c0247e0b..e529439a 100644
--- a/libqpdf/QPDFJob_json.cc
+++ b/libqpdf/QPDFJob_json.cc
@@ -413,6 +413,17 @@ Handlers::setupAddAttachmentFile()
}
void
+Handlers::beginRemoveAttachmentArray(JSON)
+{
+ // nothing needed
+}
+
+void
+Handlers::endRemoveAttachmentArray()
+{
+ // nothing needed
+}
+void
Handlers::beginCopyAttachmentsFromArray(JSON)
{
// nothing needed
diff --git a/libqpdf/qpdf/auto_job_json_decl.hh b/libqpdf/qpdf/auto_job_json_decl.hh
index 7f996928..f02dc657 100644
--- a/libqpdf/qpdf/auto_job_json_decl.hh
+++ b/libqpdf/qpdf/auto_job_json_decl.hh
@@ -29,6 +29,8 @@ void endAddAttachmentArray();
void beginAddAttachment(JSON);
void endAddAttachment();
void setupAddAttachmentFile();
+void beginRemoveAttachmentArray(JSON);
+void endRemoveAttachmentArray();
void beginCopyAttachmentsFromArray(JSON);
void endCopyAttachmentsFromArray();
void beginCopyAttachmentsFrom(JSON);
diff --git a/libqpdf/qpdf/auto_job_json_init.hh b/libqpdf/qpdf/auto_job_json_init.hh
index 2f807469..3c83ec2d 100644
--- a/libqpdf/qpdf/auto_job_json_init.hh
+++ b/libqpdf/qpdf/auto_job_json_init.hh
@@ -327,7 +327,9 @@ popHandler(); // key: replace
popHandler(); // array: .addAttachment[]
popHandler(); // key: addAttachment
pushKey("removeAttachment");
+beginArray(bindJSON(&Handlers::beginRemoveAttachmentArray), bindBare(&Handlers::endRemoveAttachmentArray)); // .removeAttachment[]
addParameter([this](std::string const& p) { c_main->removeAttachment(p); });
+popHandler(); // array: .removeAttachment[]
popHandler(); // key: removeAttachment
pushKey("copyAttachmentsFrom");
beginArray(bindJSON(&Handlers::beginCopyAttachmentsFromArray), bindBare(&Handlers::endCopyAttachmentsFromArray)); // .copyAttachmentsFrom[]
diff --git a/libqpdf/qpdf/auto_job_schema.hh b/libqpdf/qpdf/auto_job_schema.hh
index ca9fc1e1..557af9ee 100644
--- a/libqpdf/qpdf/auto_job_schema.hh
+++ b/libqpdf/qpdf/auto_job_schema.hh
@@ -111,7 +111,9 @@ static constexpr char const* JOB_SCHEMA_DATA = R"({
"replace": "replace attachment with same key"
}
],
- "removeAttachment": "remove an embedded file",
+ "removeAttachment": [
+ "remove an embedded file"
+ ],
"copyAttachmentsFrom": [
{
"file": "file to copy attachments from",