summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2017-11-09 15:06:01 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2017-11-09 16:35:10 +0100
commit03f58aa36c5150ea305b5fd0023e0ec53a334051 (patch)
treed9962295e88454d90e25f4958c13946020343ae1 /dbaccess
parent38c03b07b66a80d87221064b6e88c5e206d64817 (diff)
dbaccess: properly encode path to prevent stripping "fragment" from it
When a path contains "#" character, it must be encoded to prevent detecting it as URI's "fragment" separator, and subsequent stripping of following path part (e.g., in SfxMedium::Init_Impl). Change-Id: Ide08f8c13dc2296d9aecba92c96f1b29cc4538de Reviewed-on: https://gerrit.libreoffice.org/44538 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/core/dataaccess/databasecontext.cxx6
-rw-r--r--dbaccess/source/filter/xml/xmlfilter.cxx6
2 files changed, 9 insertions, 3 deletions
diff --git a/dbaccess/source/core/dataaccess/databasecontext.cxx b/dbaccess/source/core/dataaccess/databasecontext.cxx
index b2cc08996dbf..6b0509fbc174 100644
--- a/dbaccess/source/core/dataaccess/databasecontext.cxx
+++ b/dbaccess/source/core/dataaccess/databasecontext.cxx
@@ -368,7 +368,11 @@ 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 = aURL.GetHost(INetURLObject::DecodeMechanism::WithCharset) + aURL.GetURLPath(INetURLObject::DecodeMechanism::WithCharset);
+ 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);
aArgs.put("BaseURI", sBaseURI);
}
diff --git a/dbaccess/source/filter/xml/xmlfilter.cxx b/dbaccess/source/filter/xml/xmlfilter.cxx
index f386206bec66..a3acde8f6c94 100644
--- a/dbaccess/source/filter/xml/xmlfilter.cxx
+++ b/dbaccess/source/filter/xml/xmlfilter.cxx
@@ -311,8 +311,10 @@ 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 = aURL.GetHost(INetURLObject::DecodeMechanism::WithCharset);
- sStreamRelPath = aURL.GetURLPath(INetURLObject::DecodeMechanism::WithCharset);
+ 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);
if (sStreamRelPath.startsWith("/"))
sStreamRelPath = sStreamRelPath.copy(1);
}