[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - sw/qa sw/source

Vasily Melenchuk vasily.melenchuk at cib.de
Tue May 19 05:09:14 PDT 2015


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

New commits:
commit 7ce44f5f8e786a1bfd56aad8e30ef52702115ba2
Author: Vasily Melenchuk <vasily.melenchuk at cib.de>
Date:   Mon May 4 17:24:09 2015 +0300

    tdf#90905 fix for url encoding in internal urls
    
    Do not try to use INetURLObject class for encoding of internal document links.
    External URLs are encoded as before.
    
    Change-Id: I90621819ed21c3f793171ac4ab3fc7d49ac69f56
    Reviewed-on: https://gerrit.libreoffice.org/15625
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    (cherry picked from commit d82c035953347a19bbbc5eda61e1c9389bf3b73b)
    Signed-off-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/qa/extras/htmlexport/data/tdf90905.odt b/sw/qa/extras/htmlexport/data/tdf90905.odt
new file mode 100644
index 0000000..cab8a04
Binary files /dev/null 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 47cffc7..54f7bf1 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -243,6 +243,15 @@ DECLARE_HTMLEXPORT_TEST(testExportUrlEncoding, "tdf76291.odt")
     assertXPath(pDoc, "/html/body/p/a[2]", "href", "http://www.youtube.com/results?search_query=%E7%B2%B5%E8%AA%9Emv&sm=12");
 }
 
+DECLARE_HTMLEXPORT_TEST(testExportInternalUrl, "tdf90905.odt")
+{
+    htmlDocPtr pDoc = parseHtml(maTempFile);
+    CPPUNIT_ASSERT(pDoc);
+
+    // Internal url should be valid
+    assertXPath(pDoc, "/html/body/p/a", "href", "#0.0.1.Text|outline");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx
index 26b8ab6..5de95b2 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -1198,8 +1198,12 @@ OUString SwHTMLWriter::convertHyperlinkHRefValue(const OUString& rURL)
             }
         }
     }
-    INetURLObject aURL( sURL );
-    return URIHelper::simpleNormalizedMakeRelative( GetBaseURL(), aURL.GetMainURL( INetURLObject::NO_DECODE ) );
+    else
+    {
+        INetURLObject aURL(sURL);
+        sURL = aURL.GetMainURL(INetURLObject::NO_DECODE);
+    }
+    return URIHelper::simpleNormalizedMakeRelative( GetBaseURL(), sURL );
 }
 
 void SwHTMLWriter::OutHyperlinkHRefValue( const OUString& rURL )


More information about the Libreoffice-commits mailing list