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

Vasily Melenchuk vasily.melenchuk at cib.de
Fri Feb 6 15:46:33 PST 2015


 sw/qa/extras/htmlexport/data/tdf76291.odt |binary
 sw/qa/extras/htmlexport/htmlexport.cxx    |    9 +++++++++
 sw/source/filter/html/wrthtml.cxx         |    4 +++-
 3 files changed, 12 insertions(+), 1 deletion(-)

New commits:
commit fafd6cd4f784e5b65548af699bc25502f10a4b8d
Author: Vasily Melenchuk <vasily.melenchuk at cib.de>
Date:   Thu Feb 5 11:57:13 2015 +0000

    tdf#76291 unit test for html export href encoding
    
    Change-Id: I273af8b570adfcb7bfb784495bc31d2f4f1ee00b
    Reviewed-on: https://gerrit.libreoffice.org/14333
    Tested-by: Michael Stahl <mstahl at redhat.com>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    (cherry picked from commit 675e1fe198298702ced8eab02a7df5164d66a8f0)
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

diff --git a/sw/qa/extras/htmlexport/data/tdf76291.odt b/sw/qa/extras/htmlexport/data/tdf76291.odt
new file mode 100644
index 0000000..68588c8
Binary files /dev/null and b/sw/qa/extras/htmlexport/data/tdf76291.odt differ
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx
index d8c673c..aaa43d6 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -233,6 +233,15 @@ DECLARE_HTMLEXPORT_TEST(testExportCheckboxRadioButtonState, "checkbox-radiobutto
     assertXPathNoAttribute(pDoc, "/html/body/form/p[4]/input", "checked");
 }
 
+DECLARE_HTMLEXPORT_TEST(testExportUrlEncoding, "tdf76291.odt")
+{
+    htmlDocPtr pDoc = parseHtml(maTempFile);
+    CPPUNIT_ASSERT(pDoc);
+    
+    // Test URI encoded hyperlink with Chinese characters
+    assertXPath(pDoc, "/html/body/p/a", "href", "http://www.youtube.com/results?search_query=%E7%B2%B5%E8%AA%9Emv&sm=12");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 4327b7882c38005d89b07e76814705d1c53f3161
Author: Vasily Melenchuk <vasily.melenchuk at cib.de>
Date:   Tue Jan 27 16:18:24 2015 +0000

    tdf#76291 write encoded URL as href in html output
    
    INetURLObject class is used to create correctly encoded URL
    
    Change-Id: Icc9e71e848fd8a0b487f74232b9ad3e7ddde50b4
    Signed-off-by: Stephan Bergmann <sbergman at redhat.com>
    (cherry picked from commit 0706b5756e06b7773a78e3046a47efc2c81d92b1)
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx
index f9d60e5..26b8ab6 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -81,6 +81,7 @@
 #include <IDocumentSettingAccess.hxx>
 #include <IDocumentStylePoolAccess.hxx>
 #include <xmloff/odffields.hxx>
+#include <tools/urlobj.hxx>
 
 #define MAX_INDENT_LEVEL 20
 
@@ -1197,7 +1198,8 @@ OUString SwHTMLWriter::convertHyperlinkHRefValue(const OUString& rURL)
             }
         }
     }
-    return URIHelper::simpleNormalizedMakeRelative(GetBaseURL(), sURL);
+    INetURLObject aURL( sURL );
+    return URIHelper::simpleNormalizedMakeRelative( GetBaseURL(), aURL.GetMainURL( INetURLObject::NO_DECODE ) );
 }
 
 void SwHTMLWriter::OutHyperlinkHRefValue( const OUString& rURL )


More information about the Libreoffice-commits mailing list