From 24c20f1e1689fcae39c1b9809f107e8f7425944e Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 15 Feb 2016 10:51:12 +0100 Subject: [PATCH] xmlsecurity OOXML export: fix missing rels content-type This wasn't a problem when we signed MSO-produced documents that have these all the time, but it was a problem for LO-produced documents. We don't add an explicit content type for _xmlsignatures/origin.sigs, so need a default for the .sigs extension. Change-Id: Ic5d0647991c42f9f1ef3519986a4bd1b56de396d --- xmlsecurity/source/helper/xmlsignaturehelper.cxx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/xmlsecurity/source/helper/xmlsignaturehelper.cxx b/xmlsecurity/source/helper/xmlsignaturehelper.cxx index 056a187a70a2..59f2cac65a69 100644 --- a/xmlsecurity/source/helper/xmlsignaturehelper.cxx +++ b/xmlsecurity/source/helper/xmlsignaturehelper.cxx @@ -525,18 +525,23 @@ void XMLSignatureHelper::ExportSignatureContentTypes(css::uno::Reference& rDefaults = aContentTypeInfo[0]; + auto aDefaults = comphelper::sequenceToContainer< std::vector >(rDefaults); auto it = std::find_if(rDefaults.begin(), rDefaults.end(), [](const beans::StringPair& rPair) + { + return rPair.First == "rels"; + }); + if (it == rDefaults.end()) + aDefaults.push_back(beans::StringPair("rels", "application/vnd.openxmlformats-package.relationships+xml")); + + it = std::find_if(rDefaults.begin(), rDefaults.end(), [](const beans::StringPair& rPair) { return rPair.First == "sigs"; }); if (it == rDefaults.end()) - { - auto aDefaults = comphelper::sequenceToContainer< std::vector >(rDefaults); aDefaults.push_back(beans::StringPair("sigs", "application/vnd.openxmlformats-package.digital-signature-origin")); - rDefaults = comphelper::containerToSequence(aDefaults); - } + rDefaults = comphelper::containerToSequence(aDefaults); // Remove existing signature overrides. uno::Sequence& rOverrides = aContentTypeInfo[1];