summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasily Melenchuk <vasily.melenchuk@cib.de>2015-05-04 17:24:09 +0300
committerMichael Stahl <mstahl@redhat.com>2015-05-19 13:56:21 +0200
commit7ce44f5f8e786a1bfd56aad8e30ef52702115ba2 (patch)
tree0babe7d9e217ba4b0e02c5fe0e36d34e94b84388
parent61ca9f427adf4f356535ce9fa9f1ebe7332d0883 (diff)
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@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com> (cherry picked from commit d82c035953347a19bbbc5eda61e1c9389bf3b73b) Signed-off-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r--sw/qa/extras/htmlexport/data/tdf90905.odtbin0 -> 11824 bytes
-rw-r--r--sw/qa/extras/htmlexport/htmlexport.cxx9
-rw-r--r--sw/source/filter/html/wrthtml.cxx8
3 files changed, 15 insertions, 2 deletions
diff --git a/sw/qa/extras/htmlexport/data/tdf90905.odt b/sw/qa/extras/htmlexport/data/tdf90905.odt
new file mode 100644
index 000000000000..cab8a04fa12e
--- /dev/null
+++ b/sw/qa/extras/htmlexport/data/tdf90905.odt
Binary files differ
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx
index 47cffc7cdfa6..54f7bf1fcb5f 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 26b8ab63b2dc..5de95b2f534f 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 )