sw/qa/extras/ooxmlexport/data/tdf126590.docx |binary sw/qa/extras/ooxmlexport/ooxmllinks.cxx | 10 ++++++++++ writerfilter/source/dmapper/DomainMapper_Impl.cxx | 8 +++++++- 3 files changed, 17 insertions(+), 1 deletion(-)
New commits: commit b165ac2ab54737a3cf0424584e97cc0b0f565a27 Author: Tünde Tóth <tund...@gmail.com> AuthorDate: Tue Jul 30 09:29:24 2019 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Mon Aug 12 10:01:36 2019 +0200 tdf#126590 DOCX import: fix absolute hyperlinks to documents Absolute links in DOCX documents created with Word didn't work. Change-Id: Ie23c9ded1c88752768b925ec26df3061beeddd8e Reviewed-on: https://gerrit.libreoffice.org/76581 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/77191 diff --git a/sw/qa/extras/ooxmlexport/data/tdf126590.docx b/sw/qa/extras/ooxmlexport/data/tdf126590.docx new file mode 100644 index 000000000000..147db4565275 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf126590.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmllinks.cxx b/sw/qa/extras/ooxmlexport/ooxmllinks.cxx index 146497c23957..129a1363f642 100644 --- a/sw/qa/extras/ooxmlexport/ooxmllinks.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmllinks.cxx @@ -216,6 +216,16 @@ DECLARE_LINKS_EXPORT_TEST(testAbsoluteToAbsoluteExport, "absolute-link.docx", US CPPUNIT_ASSERT(sTarget.endsWith("test.docx")); } +DECLARE_LINKS_EXPORT_TEST(testTdf126590_export, "tdf126590.docx", USE_ABSOLUTE, DONT_MODIFY_LINK) +{ + xmlDocPtr pXmlDoc = parseExport("word/_rels/document.xml.rels"); + if (!pXmlDoc) + return; + // in the original file: Target="file:///C:\TEMP\test.docx" => invalid file URI + assertXPath(pXmlDoc, "/rels:Relationships/rels:Relationship[@TargetMode='External']", "Target", + "file:///C:/TEMP/test.docx"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index fbfffe1b2317..74591334637a 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -4493,10 +4493,16 @@ void DomainMapper_Impl::CloseFieldCommand() if (!sURL.isEmpty()) { + if (sURL.startsWith("file:///")) + { + // file:///absolute\path\to\file => invalid file URI (Writer cannot open) + // convert all blackslashes to slashes: + sURL = sURL.replace('\\', '/'); + } // Try to make absolute any relative URLs, except // for relative same-document URLs that only contain // a fragment part: - if (!sURL.startsWith("#") && !m_aSaveOpt.IsSaveRelFSys()) { + else if (!sURL.startsWith("#") && !m_aSaveOpt.IsSaveRelFSys()) { try { sURL = rtl::Uri::convertRelToAbs( m_aBaseUrl, sURL); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits