summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-09-04 11:49:25 +0200
committerAndras Timar <andras.timar@collabora.com>2015-09-18 10:10:24 +0200
commitb042cbcf4b2fc606fddb4b1c7c11b6cf2c5adf8c (patch)
treeba1c10983f1fbb07adaae86efaf789ec29229ba7 /oox
parent31bdd12b56aad54ce4d9a3a3c927bc970aa1e5a3 (diff)
tdf#93097 oox: fix import of metadata from non-relative stream paths
Commit ef2668bad976f1fbb70759887cafd35ea7833655 (PPTX import: fix missing document metadata, 2014-08-28) implemented metadata import for the PPTX filter, but in case the metadata stream is not an existing one, then OHierarchyHolder_Impl::GetListPathFromString() invoked by OStorage::openStreamElementByHierarchicalName() throws. The bugdoc is generated by a 3rd-party tool that always starts the stream path with a slash, and MSO seems to just ignore that: so let's do the same to be able to open the document. Change-Id: I6c0715adeb19b9055669f6a45055415dd2c44e28 (cherry picked from commit 46cf9bb76b29f2bfa6639d9aaf4f26dee365bc0c) Reviewed-on: https://gerrit.libreoffice.org/18368 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/docprop/ooxmldocpropimport.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/oox/source/docprop/ooxmldocpropimport.cxx b/oox/source/docprop/ooxmldocpropimport.cxx
index c711f2f97de7..646c09c68437 100644
--- a/oox/source/docprop/ooxmldocpropimport.cxx
+++ b/oox/source/docprop/ooxmldocpropimport.cxx
@@ -80,8 +80,13 @@ Sequence< InputSource > lclGetRelatedStreams( const Reference< XStorage >& rxSto
const StringPair& rEntry = rEntries[ nEntryIndex ];
if ( rEntry.First == "Target" )
{
+ // The stream path is always a relative one, ignore the leading "/" if it's there.
+ OUString aStreamPath = rEntry.Second;
+ if (aStreamPath.startsWith("/"))
+ aStreamPath = aStreamPath.copy(1);
+
Reference< XExtendedStorageStream > xExtStream(
- xHierarchy->openStreamElementByHierarchicalName( rEntry.Second, ElementModes::READ ), UNO_QUERY_THROW );
+ xHierarchy->openStreamElementByHierarchicalName( aStreamPath, ElementModes::READ ), UNO_QUERY_THROW );
Reference< XInputStream > xInStream = xExtStream->getInputStream();
if( xInStream.is() )
{