#398 Bug 3542900: URL parsing too restrictive

Next_major_release
closed
Don HO
None
8
2013-07-31
2012-07-12
Andreas Jonsson
No

https://sourceforge.net/tracker/?func=detail&aid=3542900&group_id=95717&atid=612382

When clicking on a hotspot, the program mistakenly thinks an URL begins or ends too early if it contains a comma.

If you click to the left of the comma in, say, "http://www.test.com/a,b" the program will only try to match "http://www.test.com/a" as a URL. If you click to the right of the comma, it tries to match "b".

Solution: add a comma to the list of allowed characters.

About the parentheses: according to the RFC they are in fact valid URL characters, but they're obviously very uncommon. You are more likely to encounter parentheses enclosing a URL rather than being part of one, like "if you visit the website (http://www.test.com/test.html)...". Personally, if I click on that link I want to go to "test.com/test.html" and not "test.com/test.html)".

Thus, only alphanumerics, the special characters "$-_.+!*'(),", and
reserved characters used for their reserved purposes may be used
unencoded within a URL.

http://www.ietf.org/rfc/rfc1738.txt

Discussion

  •  
    Attachments
  • On second thought, url.patch is no good. Instead, how about removing the last character from the URL if it's a comma or parenthesis? See url2.patch. Then N++ would handle all of reasonable cases correctly. Admittedly it would fail on some valid URLs where there's actually supposed to be a comma or parenthesis at the end.

     
  •  
    Attachments
  • Achin Jain
    Achin Jain
    2012-08-22

    HI, I am currently working on this bug. I have fixed it. Will upload the patch soon. Just want to ask what link should open if the user gives
    1) "http://www.something.com("
    2) "http://www.something.com,,,,"

    In my opinion the links that should open should be
    1) "http://www.something.com("
    2) "http://www.something.com"

     
  • Don HO
    Don HO
    2012-10-07

    • assigned_to: nobody --> donho
    • priority: 5 --> 8
     
  • Don HO
    Don HO
    2013-07-31

    • status: open --> closed
    • Group: --> Next_major_release