From 9a29f0c593a0e27322ecf7ca3b9688deaa8ed292 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 4 Nov 2024 08:30:54 +0100 Subject: [PATCH] cool#9992 doc sign: fix handling of saveas options containing spaces Trying to create signed PDFs during ODT->PDF conversion, a signature is created, but it's not valid. The first trouble noticed while investigating is that the saveas option we get is like this: debug:666:660: doc_saveAs: pFilterOptions is '{"SignPDF":{"type":"boolean","value":"true"},"SignCertificateCaPem":{"type":"string","value":"-----BEGINCERTIFICATE----- While this should be '-----BEGIN CERTIFICATE-----', since the syntax is "saveas ... [options=]". Fix the problem in ChildSession::saveAs(), where a space was lost while "saveas ... options=foo bar" was tokenized as "saveas", "...", "options=foo" and "bar", and later we constructed as "foobar", not "foo bar". Signed-off-by: Miklos Vajna Change-Id: Ibadcb3218d8776191193ca13788cfca4a8d1e11d --- kit/ChildSession.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp index 355324499bd0..fcf0b13a9a2c 100644 --- a/kit/ChildSession.cpp +++ b/kit/ChildSession.cpp @@ -2759,7 +2759,8 @@ bool ChildSession::saveAs(const StringVector& tokens) { if (tokens.size() > 4) { - filterOptions += tokens.cat(' ', 4); + // Syntax is options=, and may contain spaces, account for that. + filterOptions += " " + tokens.cat(' ', 4); } }