[Libreoffice-bugs] [Bug 125041] URL in unicode interpretate as file link

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Thu Aug 1 15:56:41 UTC 2019


https://bugs.documentfoundation.org/show_bug.cgi?id=125041

Xisco FaulĂ­ <xiscofauli at libreoffice.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |bibisected
                 CC|                            |sbergman at redhat.com

--- Comment #8 from Xisco FaulĂ­ <xiscofauli at libreoffice.org> ---
Doing something like this

--- a/sw/source/uibase/wrtsh/wrtsh2.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh2.cxx
@@ -488,6 +488,16 @@ bool SwWrtShell::ClickToINetGrf( const Point& rDocPt,
LoadUrlFlags nFilter )
     return bRet;
 }

+
+static bool isAscii( const OUString& rStr )
+{
+    sal_Int32 nLen = rStr.getLength();
+    for( sal_Int32 i = 0; i < nLen; i++ )
+        if( rStr[i] > 127 )
+            return false;
+    return true;
+}
+
 void LoadURL( SwViewShell& rVSh, const OUString& rURL, LoadUrlFlags nFilter,
               const OUString& rTargetFrameName )
 {
@@ -501,7 +511,7 @@ void LoadURL( SwViewShell& rVSh, const OUString& rURL,
LoadUrlFlags nFilter,

     OUString sFileURL = rURL;
     INetURLObject aURL( sFileURL );
-    if( aURL.GetProtocol() == INetProtocol::NotValid &&
!sFileURL.startsWith("#") )
+    if( isAscii(sFileURL) && aURL.GetProtocol() == INetProtocol::NotValid &&
!sFileURL.startsWith("#") )

could fix the issue, however, the real fix should be done in INetURLObject so
it accepts non-ascii characters in the host as a valid URL.

@Stephan, I thought you might be interested in this issue...

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20190801/47cb14d4/attachment.html>


More information about the Libreoffice-bugs mailing list