summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-02-15 10:51:12 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-02-15 11:11:52 +0100
commit24c20f1e1689fcae39c1b9809f107e8f7425944e (patch)
tree7e5eeb25983cfc75bc1617855ac7c70a79ff6e48
parent38c14a06c1603c73b7fc32f7a92d48238553bd18 (diff)
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
-rw-r--r--xmlsecurity/source/helper/xmlsignaturehelper.cxx15
1 files 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<css::em
return;
}
- // Append sigs to defaults, if it's not there already.
+ // Append rels and sigs to defaults, if it's not there already.
uno::Sequence<beans::StringPair>& rDefaults = aContentTypeInfo[0];
+ auto aDefaults = comphelper::sequenceToContainer< std::vector<beans::StringPair> >(rDefaults);
auto it = std::find_if(rDefaults.begin(), rDefaults.end(), [](const beans::StringPair& rPair)
{
- return rPair.First == "sigs";
+ 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)
{
- auto aDefaults = comphelper::sequenceToContainer< std::vector<beans::StringPair> >(rDefaults);
+ return rPair.First == "sigs";
+ });
+ if (it == rDefaults.end())
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<beans::StringPair>& rOverrides = aContentTypeInfo[1];