summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-11-21 11:53:08 +0100
committerStephan Bergmann <sbergman@redhat.com>2019-11-21 16:47:19 +0100
commit4d9fbf446e2807d27fc1855e9be2e55abedcee4f (patch)
treef9181f813201499acbb02ae97b295eb15e644650 /tools
parent99e0e14d2441c44b554608da416f3cd3b2207521 (diff)
tdf#128598: Revert "Move dubious file: -> smb: conversion from...
INetURLObject to file UCP" It turns out that there is lots of code in and around e.g. SfxMedium::LockOrigFileOnDemand (sfx2/source/doc/docfile.cxx) that treats document URLs non-generically and treats file URLs specially. That means that it does not work to transparently rewrite a file URL as an smb URL in the underlying UCB layer. So for libreoffice-6-4 revert the change again. (For master towards LO 6.5, I plan to instead completely drop the feature of silently treating certain forms of file URLs on Linux as smb URLs.) This reverts commit 46c645bf4e9909f5296e75028f1f5434e83942d2. Conflicts: tools/qa/cppunit/test_urlobj.cxx ucb/source/ucp/file/prov.cxx Change-Id: I94ac0637115bea36924099951efd8542854a727d Reviewed-on: https://gerrit.libreoffice.org/83396 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/qa/cppunit/test_urlobj.cxx10
-rw-r--r--tools/source/fsys/urlobj.cxx11
2 files changed, 20 insertions, 1 deletions
diff --git a/tools/qa/cppunit/test_urlobj.cxx b/tools/qa/cppunit/test_urlobj.cxx
index 0e25decab713..127e01067ec8 100644
--- a/tools/qa/cppunit/test_urlobj.cxx
+++ b/tools/qa/cppunit/test_urlobj.cxx
@@ -49,7 +49,11 @@ namespace tools_urlobj
void urlobjTest_001( )
{
INetURLObject aUrl( OUString( "file://10.10.1.1/sampledir/sample.file" ) );
- CPPUNIT_ASSERT_EQUAL(INetProtocol::File, aUrl.GetProtocol());
+#ifdef LINUX
+ CPPUNIT_ASSERT_EQUAL(OUString("smb://10.10.1.1/sampledir/sample.file"),
+ aUrl.GetMainURL(INetURLObject::DecodeMechanism::NONE));
+ CPPUNIT_ASSERT_EQUAL(INetProtocol::Smb, aUrl.GetProtocol());
+#endif
CPPUNIT_ASSERT_EQUAL(OUString("10.10.1.1"),
aUrl.GetHost(INetURLObject::DecodeMechanism::NONE));
CPPUNIT_ASSERT_EQUAL(OUString("/sampledir/sample.file"),
@@ -63,7 +67,11 @@ namespace tools_urlobj
void urlobjTest_004( )
{
INetURLObject aUrl( OUString( "smb://10.10.1.1/sampledir/sample.file" ) );
+#ifdef LINUX
+ CPPUNIT_ASSERT_EQUAL(OUString("smb://10.10.1.1/sampledir/sample.file"),
+ aUrl.GetMainURL(INetURLObject::DecodeMechanism::NONE));
CPPUNIT_ASSERT_EQUAL( INetProtocol::Smb, aUrl.GetProtocol( ) );
+#endif
CPPUNIT_ASSERT_EQUAL(OUString("10.10.1.1"),
aUrl.GetHost(INetURLObject::DecodeMechanism::NONE));
CPPUNIT_ASSERT_EQUAL(OUString("/sampledir/sample.file"),
diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx
index e07cfd04035e..64daa11c9415 100644
--- a/tools/source/fsys/urlobj.cxx
+++ b/tools/source/fsys/urlobj.cxx
@@ -1445,6 +1445,17 @@ bool INetURLObject::setAbsURIRef(OUString const & rTheAbsURIRef,
m_aAbsURIRef = aSynAbsURIRef;
+ // At this point references of type "\\server\paths" have
+ // been converted to file:://server/path".
+#ifdef LINUX
+ if (m_eScheme==INetProtocol::File && !m_aHost.isEmpty()) {
+ // Change "file:://server/path" URIs to "smb:://server/path" on
+ // Linux
+ // Leave "file::path" URIs unchanged.
+ changeScheme(INetProtocol::Smb);
+ }
+#endif
+
return true;
}