sw/qa/extras/ooxmlexport/data/tdf126768.docx |binary sw/qa/extras/ooxmlexport/ooxmllinks.cxx | 9 +++++++++ writerfilter/source/dmapper/DomainMapper_Impl.cxx | 4 ++++ 3 files changed, 13 insertions(+)
New commits: commit a81ef7f4ae8021e3f6ce782ebc526e798a814a5e Author: Tünde Tóth <tund...@gmail.com> AuthorDate: Fri Aug 9 09:30:50 2019 +0200 Commit: László Németh <nem...@numbertext.org> CommitDate: Fri Aug 9 15:31:47 2019 +0200 tdf#126768 DOCX import: fix absolute hyperlinks to documents file:///absolute\\path\\to\\file didn't work in Writer. Change-Id: I61135668e47bc1d67afb4ed6bec6a90744d295cf Reviewed-on: https://gerrit.libreoffice.org/77184 Tested-by: Jenkins Reviewed-by: László Németh <nem...@numbertext.org> diff --git a/sw/qa/extras/ooxmlexport/data/tdf126768.docx b/sw/qa/extras/ooxmlexport/data/tdf126768.docx new file mode 100644 index 000000000000..7a3440e79171 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf126768.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmllinks.cxx b/sw/qa/extras/ooxmlexport/ooxmllinks.cxx index 0a9ab492e0e7..406af22d6ada 100644 --- a/sw/qa/extras/ooxmlexport/ooxmllinks.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmllinks.cxx @@ -250,6 +250,15 @@ DECLARE_LINKS_EXPORT_TEST(testTdf126590_export, "tdf126590.docx", USE_ABSOLUTE, "file:///C:/TEMP/test.docx"); } +DECLARE_LINKS_EXPORT_TEST(testTdf126768_export, "tdf126768.docx", USE_ABSOLUTE, DONT_MODIFY_LINK) +{ + xmlDocPtr pXmlDoc = parseExport("word/_rels/document.xml.rels"); + if (!pXmlDoc) + return; + // in the original file: "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 c5acf081afb9..e077d2bed52f 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -4514,6 +4514,10 @@ void DomainMapper_Impl::CloseFieldCommand() { if (sURL.startsWith("file:///")) { + // file:///absolute\\path\\to\\file => invalid file URI (Writer cannot open) + // convert all double backslashes to slashes: + sURL = sURL.replaceAll("\\\\", "/"); + // file:///absolute\path\to\file => invalid file URI (Writer cannot open) // convert all backslashes to slashes: sURL = sURL.replace('\\', '/'); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits