[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source

Attila Szűcs (via logerrit) logerrit at kemper.freedesktop.org
Wed Mar 3 11:13:20 UTC 2021


 sc/qa/unit/subsequent_export-test.cxx |    8 +++-----
 sc/source/filter/excel/xestream.cxx   |    5 +++--
 2 files changed, 6 insertions(+), 7 deletions(-)

New commits:
commit 0f0162aefdc7d64fdcae215ead7d6c813e676120
Author:     Attila Szűcs <szucs.attila3 at nisz.hu>
AuthorDate: Mon Dec 21 23:54:43 2020 +0100
Commit:     Gabor Kelemen <kelemen.gabor2 at nisz.hu>
CommitDate: Wed Mar 3 12:12:47 2021 +0100

    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 at numbertext.org>
    Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109535
    (cherry picked from commit 95b1411e26c1a82e110a8ccf970b8b3590427cb9)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111882
    Tested-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
    Reviewed-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>

diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index b094eb7d1ce3..f988256a8b28 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -5608,11 +5608,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 an other bug,
-    // on linux some other directory names may 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 4776bd24b4a9..da880cf6d925 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -1036,8 +1036,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 );
 


More information about the Libreoffice-commits mailing list