summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorAttila Szűcs <szucs.attila3@nisz.hu>2020-12-21 23:54:43 +0100
committerLászló Németh <nemeth@numbertext.org>2020-12-23 11:16:03 +0100
commit610153dd28b57ea2670f5cf240e4da9655fb7093 (patch)
tree9b9fd8cc9b08b53aa220e59b43273ab6ec37dba6 /sc
parentcf5715da45ddce8b667f1b999d41c4e6e7e65659 (diff)
tdf#121472 XLSX export: fix external Linux path
Removed the extra 4th '/' after 'file:///' from aData.maBasePath at exportDocument(). In Linux, the root path could start with '/'.. like /home/... in that case 'file:///'+'/home/..' resulted 'file:////home/ that is invalid. Co-authored-by: Tibor Nagy (NISZ) Change-Id: Ia37a11def80df2747578807ee021fafe38d48ec0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108131 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/subsequent_export-test.cxx8
-rw-r--r--sc/source/filter/excel/xestream.cxx5
2 files changed, 6 insertions, 7 deletions
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index bcfa926c9314..e29e7a5ee648 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -5636,11 +5636,9 @@ void ScExportTest::testTdf138824_linkToParentDirectory()
pXPathFile, m_xSFactory, "xl/externalLinks/_rels/externalLink1.xml.rels");
CPPUNIT_ASSERT(pDoc);
- // it should be "../tdf138824_externalSource.ods" but because of another bug,
- // on linux some other directory names may be added into the middle
- OUString aValue = getXPath(pDoc, "/r:Relationships/r:Relationship", "Target");
- CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(aValue.indexOf("../")));
- CPPUNIT_ASSERT(aValue.indexOf("/tdf138824_externalSource.ods") > 0);
+ // test also the Linux specific bug tdf#121472
+ assertXPath(pDoc, "/r:Relationships/r:Relationship", "Target",
+ "../tdf138824_externalSource.ods");
xDocSh->DoClose();
}
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index 28f9e9f815ab..5d8723d026ef 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -1035,8 +1035,9 @@ bool XclExpXmlStream::exportDocument()
aData.mpCompileFormulaCxt = std::make_shared<sc::CompileFormulaContext>(rDoc);
// set target path to get correct relative links to target document, not source
INetURLObject aPath(getFileUrl());
- aData.maBasePath = aPath.GetPath() + "\\";
- aData.maBasePath = "file:///" + aData.maBasePath.replace('\\', '/');
+ aData.maBasePath = OUString("file:///" + aPath.GetPath() + "\\").replace('\\', '/')
+ // fix for Linux
+ .replaceFirst("file:////", "file:///");
XclExpRoot aRoot( aData );