tdf#125041 fix hyperlinks to IDN websites
authorTünde Tóth <tundeth@gmail.com>
Thu, 1 Aug 2019 13:26:55 +0000 (15:26 +0200)
committerBastien Roucariès <rouca@debian.org>
Fri, 29 Dec 2023 09:39:36 +0000 (09:39 +0000)
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 <nemeth@numbertext.org>
Tested-by: László Németh <nemeth@numbertext.org>
Gbp-Pq: Name 0091-tdf-125041-fix-hyperlinks-to-IDN-websites.patch

sw/source/uibase/wrtsh/wrtsh2.cxx

index cce9e8b9227be0972741f80f1dd1751a6ed193d4..072e2995e6f76f1a108b3034e65077876817cd88 100644 (file)
@@ -502,28 +502,11 @@ void LoadURL( SwViewShell& rVSh, const OUString& rURL, LoadUrlFlags nFilter,
     if ( dynamic_cast<const SwCursorShell*>( &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 );