Skip to content

Commit

Permalink
cool#9992 doc sign: fix handling of saveas options containing spaces
Browse files Browse the repository at this point in the history
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=<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 <options> as "foobar", not "foo
bar".

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Ibadcb3218d8776191193ca13788cfca4a8d1e11d
  • Loading branch information
vmiklos committed Nov 4, 2024
1 parent 6bcced1 commit 9a29f0c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kit/ChildSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2759,7 +2759,8 @@ bool ChildSession::saveAs(const StringVector& tokens)
{
if (tokens.size() > 4)
{
filterOptions += tokens.cat(' ', 4);
// Syntax is options=<options>, and <options> may contain spaces, account for that.
filterOptions += " " + tokens.cat(' ', 4);
}
}

Expand Down

0 comments on commit 9a29f0c

Please sign in to comment.