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 12:00:12 +0000
commitd82c035953347a19bbbc5eda61e1c9389bf3b73b (patch)
treefb93fe9f64d64ae8bb43d442fc8624f02982708d
parent76c61ced4eaa5f69b948dca7537028eaa88225b3 (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>
-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 30e9263e0875..77db88b1e95d 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -244,6 +244,15 @@ DECLARE_HTMLEXPORT_TEST(testExportUrlEncoding, "tdf76291.odt")
assertXPath(pDoc, "/html/body/p/a", "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 548d1c940bf9..6cc813d68b5a 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 )