summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasily Melenchuk <vasily.melenchuk@cib.de>2015-08-25 17:45:11 +0300
committerMichael Stahl <mstahl@redhat.com>2015-09-15 16:51:22 +0200
commit0bd99a77e1655cee63ad7ec2bb25e45d13aac44d (patch)
treec9cacd9fec00e1b0161954b7a5bd290d9a8f9678
parentc9a290c2a87e9af3b0cd4ccbdd751dddab3532da (diff)
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@CIB.de> Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> (cherry picked from commit fd3468024e1ac199f4a2f4108321ef8100d58414) Signed-off-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r--sw/qa/extras/htmlexport/data/tdf90905.odtbin11824 -> 12166 bytes
-rw-r--r--sw/qa/extras/htmlexport/htmlexport.cxx3
-rw-r--r--sw/source/filter/html/wrthtml.cxx3
3 files changed, 4 insertions, 2 deletions
diff --git a/sw/qa/extras/htmlexport/data/tdf90905.odt b/sw/qa/extras/htmlexport/data/tdf90905.odt
index cab8a04fa12e..19a51bdf8fcf 100644
--- a/sw/qa/extras/htmlexport/data/tdf90905.odt
+++ 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 54f7bf1fcb5f..ca6ad26f1514 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -249,7 +249,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 5de95b2f534f..04d060493aa4 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);
}