Kaydet (Commit) fd346802 authored tarafından Vasily Melenchuk's avatar Vasily Melenchuk Kaydeden (comit) Thorsten Behrens

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/17993Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
Tested-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
üst 9e318c09
......@@ -250,7 +250,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();
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment