summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dbaccess/source/core/dataaccess/databasecontext.cxx6
-rw-r--r--dbaccess/source/filter/xml/xmlfilter.cxx6
-rw-r--r--sw/source/uibase/dbui/dbmgr.cxx19
3 files changed, 19 insertions, 12 deletions
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);
}
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 5cf02afffd2d..47cd5f13d469 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -17,6 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <cassert>
#include <cstdarg>
#include <unotxdoc.hxx>
@@ -26,6 +29,8 @@
#include <com/sun/star/sdb/XDocumentDataSource.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/uri/UriReferenceFactory.hpp>
+#include <com/sun/star/uri/VndSunStarPkgUrlReferenceFactory.hpp>
#include <com/sun/star/util/NumberFormatter.hpp>
#include <com/sun/star/sdb/DatabaseContext.hpp>
#include <com/sun/star/sdb/TextConnectionSettings.hpp>
@@ -2858,9 +2863,17 @@ void SwDBManager::LoadAndRegisterEmbeddedDataSource(const SwDBData& rData, const
// Encode the stream name and the real path into a single URL.
const INetURLObject& rURLObject = rDocShell.GetMedium()->GetURLObject();
- OUString aURL = "vnd.sun.star.pkg://";
- aURL += INetURLObject::encode(rURLObject.GetMainURL(INetURLObject::DecodeMechanism::WithCharset), INetURLObject::PART_AUTHORITY, INetURLObject::EncodeMechanism::All);
- aURL += "/" + INetURLObject::encode(m_sEmbeddedName, INetURLObject::PART_FPATH, INetURLObject::EncodeMechanism::All);
+ auto xContext(comphelper::getProcessComponentContext());
+ auto xUri = css::uri::UriReferenceFactory::create(xContext)
+ ->parse(rURLObject.GetMainURL(INetURLObject::DecodeMechanism::NONE));
+ assert(xUri.is());
+ xUri = css::uri::VndSunStarPkgUrlReferenceFactory::create(xContext)
+ ->createVndSunStarPkgUrlReference(xUri);
+ assert(xUri.is());
+ OUString const aURL = xUri->getUriReference() + "/"
+ + INetURLObject::encode(
+ m_sEmbeddedName, INetURLObject::PART_FPATH,
+ INetURLObject::EncodeMechanism::All);
uno::Reference<uno::XInterface> xDataSource(xDatabaseContext->getByName(aURL), uno::UNO_QUERY);
xDatabaseContext->registerObject( sDataSource, xDataSource );