[Libreoffice-commits] core.git: dbaccess/source

Mike Kaganski mike.kaganski at collabora.com
Thu Nov 9 15:35:42 UTC 2017


 dbaccess/source/core/dataaccess/databasecontext.cxx |    6 +++++-
 dbaccess/source/filter/xml/xmlfilter.cxx            |    6 ++++--
 2 files changed, 9 insertions(+), 3 deletions(-)

New commits:
commit 03f58aa36c5150ea305b5fd0023e0ec53a334051
Author: Mike Kaganski <mike.kaganski at collabora.com>
Date:   Thu Nov 9 15:06:01 2017 +0300

    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 at collabora.com>
    Tested-by: Mike Kaganski <mike.kaganski at collabora.com>

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);
             }


More information about the Libreoffice-commits mailing list