diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qa/cppunit/test_urlobj.cxx | 10 | ||||
-rw-r--r-- | tools/source/fsys/urlobj.cxx | 11 |
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; } |