[Libreoffice-commits] core.git: sw/qa sw/source

Vasily Melenchuk vasily.melenchuk at cib.de
Fri Aug 28 02:52:31 PDT 2015


 sw/qa/extras/htmlexport/data/tdf90905.odt |binary
 sw/qa/extras/htmlexport/htmlexport.cxx    |    3 ++-
 sw/source/filter/html/wrthtml.cxx         |    3 ++-
 3 files changed, 4 insertions(+), 2 deletions(-)

New commits:
commit fd3468024e1ac199f4a2f4108321ef8100d58414
Author: Vasily Melenchuk <vasily.melenchuk at cib.de>
Date:   Tue Aug 25 17:45:11 2015 +0300

    tdf#93449 Internal hyperlinks are not exported corectly in HTML
    
    InetURLObject class does not work correctly with internal document
    links, containing not full url, but just a fragment. This case added
    as an exception for HTML link export.
    
    Change-Id: I44496a1cf186836d4194fc65ce7bf9aeb2f79b65
    Reviewed-on: https://gerrit.libreoffice.org/17993
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/sw/qa/extras/htmlexport/data/tdf90905.odt b/sw/qa/extras/htmlexport/data/tdf90905.odt
index cab8a04..19a51bd 100644
Binary files a/sw/qa/extras/htmlexport/data/tdf90905.odt and b/sw/qa/extras/htmlexport/data/tdf90905.odt differ
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx
index 77db88b..2ce1040 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -250,7 +250,8 @@ DECLARE_HTMLEXPORT_TEST(testExportInternalUrl, "tdf90905.odt")
     CPPUNIT_ASSERT(pDoc);
 
     // Internal url should be valid
-    assertXPath(pDoc, "/html/body/p/a", "href", "#0.0.1.Text|outline");
+    assertXPath(pDoc, "/html/body/p[1]/a", "href", "#0.0.1.Text|outline");
+    assertXPath(pDoc, "/html/body/p[2]/a", "href", "#bookmark");
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx
index 1502441..4e5d57b 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -1198,8 +1198,9 @@ OUString SwHTMLWriter::convertHyperlinkHRefValue(const OUString& rURL)
             }
         }
     }
-    else
+    else if (!sURL.isEmpty() && sURL[0] != '#')
     {
+        // Link is not started from "#", so looks like external link. Encode this URL.
         INetURLObject aURL(sURL);
         sURL = aURL.GetMainURL(INetURLObject::NO_DECODE);
     }


More information about the Libreoffice-commits mailing list