From fa040f034b0f9fad9e951faf5cbb3cbc19f62fa9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?T=C3=BCnde=20T=C3=B3th?= Date: Thu, 1 Aug 2019 15:26:55 +0200 Subject: [PATCH] tdf#125041 fix hyperlinks to IDN websites MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Revert "tdf#86087 Open relative links in Writer" This reverts commit 4b9e237850efe36f7e35d65e14d6953f1e1f3a45. The reverted commit caused a regression in the handling of internationalized domain names: these non-ASCII URLs were converted to file URIs. Change-Id: Ia481aa1199d20083b72f9f8571992e40b3fc2e77 Reviewed-on: https://gerrit.libreoffice.org/76804 Reviewed-by: László Németh Tested-by: László Németh Gbp-Pq: Name 0091-tdf-125041-fix-hyperlinks-to-IDN-websites.patch --- sw/source/uibase/wrtsh/wrtsh2.cxx | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx b/sw/source/uibase/wrtsh/wrtsh2.cxx index cce9e8b9227..072e2995e6f 100644 --- a/sw/source/uibase/wrtsh/wrtsh2.cxx +++ b/sw/source/uibase/wrtsh/wrtsh2.cxx @@ -502,28 +502,11 @@ void LoadURL( SwViewShell& rVSh, const OUString& rURL, LoadUrlFlags nFilter, if ( dynamic_cast( &rVSh) == nullptr ) return; - OUString sFileURL = rURL; - INetURLObject aURL( sFileURL ); - if( aURL.GetProtocol() == INetProtocol::NotValid && !sFileURL.startsWith("#") ) - { - // May be the relative link -> try to convert to absolute path - OUString sParentPath = - rVSh.GetDoc()->GetDocShell()->GetMedium()->GetURLObject().GetPath(); - - bool bCorrectURL = true; - aURL = INetURLObject(); - bCorrectURL &= aURL.setFSysPath( sParentPath, FSysStyle::Detect ); - bCorrectURL &= aURL.insertName( sFileURL ); - - if( bCorrectURL ) - sFileURL = aURL.GetMainURL( INetURLObject::DecodeMechanism::Unambiguous ); - } - // We are doing tiledRendering, let the client handles the URL loading, // unless we are jumping to a TOC mark. if (comphelper::LibreOfficeKit::isActive() && !rURL.startsWith("#")) { - rVSh.GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_HYPERLINK_CLICKED, sFileURL.toUtf8().getStr()); + rVSh.GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_HYPERLINK_CLICKED, rURL.toUtf8().getStr()); return; } @@ -548,7 +531,7 @@ void LoadURL( SwViewShell& rVSh, const OUString& rURL, LoadUrlFlags nFilter, sReferer = pDShell->GetMedium()->GetName(); SfxViewFrame* pViewFrame = rSh.GetView().GetViewFrame(); SfxFrameItem aView( SID_DOCFRAME, pViewFrame ); - SfxStringItem aName( SID_FILE_NAME, sFileURL ); + SfxStringItem aName( SID_FILE_NAME, rURL ); SfxStringItem aTargetFrameName( SID_TARGETNAME, sTargetFrame ); SfxStringItem aReferer( SID_REFERER, sReferer ); -- 2.30.2