From bff8d843bd4e5dcca5dc1a60c2c7852b1b72a00b Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 9 Nov 2017 23:13:16 +0100 Subject: Properly construct vnd.sun.star.pkg URL ...in SwDBManager::LoadAndRegisterEmbeddedDataSource. For example, when the authority encodes a file URL whose path contains '%23' (because one of the pathname segments encoded in the file URL contains a '#' character), the original code would have left it as %23 in the vnd.sun.star.pkg URL, instead of encoding it as %2523. That lead to bad file URLs being recovered from the vnd.sun.star.pkg URL in dbaccess. (And 03f58aa36c5150ea305b5fd0023e0ec53a334051 "dbaccess: properly encode path to prevent stripping 'fragment' from it", which this commit reverts, wrongly tried to address that on the consuming instead of the producing side.) Change-Id: I17d2dc9e6306d006361fbcb63d77e93a9e20bf31 Reviewed-on: https://gerrit.libreoffice.org/44569 Reviewed-by: Mike Kaganski Tested-by: Mike Kaganski --- dbaccess/source/core/dataaccess/databasecontext.cxx | 6 +----- dbaccess/source/filter/xml/xmlfilter.cxx | 6 ++---- 2 files changed, 3 insertions(+), 9 deletions(-) (limited to 'dbaccess') diff --git a/dbaccess/source/core/dataaccess/databasecontext.cxx b/dbaccess/source/core/dataaccess/databasecontext.cxx index 6b0509fbc174..b2cc08996dbf 100644 --- a/dbaccess/source/core/dataaccess/databasecontext.cxx +++ b/dbaccess/source/core/dataaccess/databasecontext.cxx @@ -368,11 +368,7 @@ Reference< XInterface > ODatabaseContext::loadObjectFromURL(const OUString& _rNa if (bEmbeddedDataSource) { // In this case the host contains the real path, and the path is the embedded stream name. - OUString sBaseURI = - INetURLObject::encode(aURL.GetHost(INetURLObject::DecodeMechanism::WithCharset), - INetURLObject::PART_FPATH, INetURLObject::EncodeMechanism::All) - + INetURLObject::encode(aURL.GetURLPath(INetURLObject::DecodeMechanism::WithCharset), - INetURLObject::PART_FPATH, INetURLObject::EncodeMechanism::All); + OUString sBaseURI = aURL.GetHost(INetURLObject::DecodeMechanism::WithCharset) + aURL.GetURLPath(INetURLObject::DecodeMechanism::WithCharset); aArgs.put("BaseURI", sBaseURI); } diff --git a/dbaccess/source/filter/xml/xmlfilter.cxx b/dbaccess/source/filter/xml/xmlfilter.cxx index a3acde8f6c94..f386206bec66 100644 --- a/dbaccess/source/filter/xml/xmlfilter.cxx +++ b/dbaccess/source/filter/xml/xmlfilter.cxx @@ -311,10 +311,8 @@ bool ODBFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) { // In this case the host contains the real path, and the path is the embedded stream name. INetURLObject aURL(sFileName); - sFileName = INetURLObject::encode(aURL.GetHost(INetURLObject::DecodeMechanism::WithCharset), - INetURLObject::PART_FPATH, INetURLObject::EncodeMechanism::All); - sStreamRelPath = INetURLObject::encode(aURL.GetURLPath(INetURLObject::DecodeMechanism::WithCharset), - INetURLObject::PART_FPATH, INetURLObject::EncodeMechanism::All); + sFileName = aURL.GetHost(INetURLObject::DecodeMechanism::WithCharset); + sStreamRelPath = aURL.GetURLPath(INetURLObject::DecodeMechanism::WithCharset); if (sStreamRelPath.startsWith("/")) sStreamRelPath = sStreamRelPath.copy(1); } -- cgit