[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - sc/qa svl/qa tools/qa tools/source ucb/Library_ucpfile1.mk ucb/source
Stephan Bergmann (via logerrit)
logerrit at kemper.freedesktop.org
Thu Nov 21 15:48:23 UTC 2019
sc/qa/unit/subsequent_export-test.cxx | 10 ++++++++--
svl/qa/unit/test_URIHelper.cxx | 5 +++++
tools/qa/cppunit/test_urlobj.cxx | 10 +++++++++-
tools/source/fsys/urlobj.cxx | 11 +++++++++++
ucb/Library_ucpfile1.mk | 1 -
ucb/source/ucp/file/prov.cxx | 19 -------------------
6 files changed, 33 insertions(+), 23 deletions(-)
New commits:
commit 4d9fbf446e2807d27fc1855e9be2e55abedcee4f
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu Nov 21 11:53:08 2019 +0100
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Thu Nov 21 16:47:19 2019 +0100
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 at redhat.com>
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index e9ad4b5eade4..b67dcd50aac5 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -4223,12 +4223,18 @@ void ScExportTest::testTdf118990()
// file:///share/lookupsource.xlsx - which is incorrect, since it points to local filesystem
// and not to Windows network share.
+#if defined LINUX // following INetURLObject::setAbsURIRef
+#define TDF118990_SCHEME "smb:"
+#else // for Windows and macOS
+#define TDF118990_SCHEME "file:"
+#endif
+
ASSERT_FORMULA_EQUAL(rDoc, ScAddress(0, 1, 0),
- "VLOOKUP(B1,'file://192.168.1.1/share/lookupsource.xlsx'#$Sheet1.A1:B5,2)",
+ "VLOOKUP(B1,'" TDF118990_SCHEME "//192.168.1.1/share/lookupsource.xlsx'#$Sheet1.A1:B5,2)",
"Wrong Windows share (using host IP) URL in A2");
ASSERT_FORMULA_EQUAL(rDoc, ScAddress(0, 2, 0),
- "VLOOKUP(B1,'file://NETWORKHOST/share/lookupsource.xlsx'#$Sheet1.A1:B5,2)",
+ "VLOOKUP(B1,'" TDF118990_SCHEME "//NETWORKHOST/share/lookupsource.xlsx'#$Sheet1.A1:B5,2)",
"Wrong Windows share (using hostname) URL in A3");
xDocSh->DoClose();
diff --git a/svl/qa/unit/test_URIHelper.cxx b/svl/qa/unit/test_URIHelper.cxx
index e4dfbb9dd939..11b7d0359b2a 100644
--- a/svl/qa/unit/test_URIHelper.cxx
+++ b/svl/qa/unit/test_URIHelper.cxx
@@ -295,7 +295,12 @@ void Test::testFindFirstURLInText() {
"ftp://bla.bla.bla/blubber/", 3, 29 },
{ "..\\ftp://bla.bla.bla/blubber/...", nullptr, 0, 0 },
{ "..\\ftp:\\\\bla.bla.bla\\blubber/...",
+//Sync with tools/source/fsys/urlobj.cxx and changeScheme
+#ifdef LINUX
+ "smb://bla.bla.bla/blubber%2F", 7, 29 },
+#else
"file://bla.bla.bla/blubber%2F", 7, 29 },
+#endif
{ "http://sun.com", "http://sun.com/", 0, 14 },
{ "http://sun.com/", "http://sun.com/", 0, 15 },
{ "http://www.xerox.com@www.pcworld.com/go/3990332.htm", nullptr, 0, 0 },
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;
}
diff --git a/ucb/Library_ucpfile1.mk b/ucb/Library_ucpfile1.mk
index f676eacbde3f..4505708cbac8 100644
--- a/ucb/Library_ucpfile1.mk
+++ b/ucb/Library_ucpfile1.mk
@@ -21,7 +21,6 @@ $(eval $(call gb_Library_use_libraries,ucpfile1,\
cppu \
cppuhelper \
sal \
- tl \
ucbhelper \
))
diff --git a/ucb/source/ucp/file/prov.cxx b/ucb/source/ucp/file/prov.cxx
index 7c5c66e23e6e..9a7052e17304 100644
--- a/ucb/source/ucp/file/prov.cxx
+++ b/ucb/source/ucp/file/prov.cxx
@@ -20,8 +20,6 @@
#include <osl/security.hxx>
#include <osl/file.hxx>
#include <osl/socket.h>
-#include <tools/urlobj.hxx>
-#include <ucbhelper/content.hxx>
#include <cppuhelper/queryinterface.hxx>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
@@ -170,24 +168,7 @@ FileProvider::queryContent(
aUnc );
if( err )
- {
- // Hack to retry file://<host>/... URLs as smb URLs:
- INetURLObject url(xIdentifier->getContentIdentifier());
- if (url.GetProtocol() == INetProtocol::File
- && !url.GetHost(INetURLObject::DecodeMechanism::NONE).isEmpty())
- {
- url.changeScheme(INetProtocol::Smb);
- ucbhelper::Content content;
- if (ucbhelper::Content::create(
- url.GetMainURL(INetURLObject::DecodeMechanism::NONE),
- css::uno::Reference<css::ucb::XCommandEnvironment>(), m_xContext, content))
- {
- return content.get();
- }
- }
-
throw IllegalIdentifierException( THROW_WHERE );
- }
return Reference< XContent >( new BaseContent( m_pMyShell.get(), xIdentifier, aUnc ) );
}
More information about the Libreoffice-commits
mailing list