This project is archived and is in readonly mode.

#182 ✓resolved
denis

URI is parsed incorrectly when there's '@' symbol in the query string

Reported by denis | November 12th, 2009 @ 11:56 AM

var u = new URI('http://api.flickr.com/services/feeds/photoset.gne?set=7215761813614...; u.get('host') "N04&lang=en-us&format=atom"

the expected value is, obviously, "api.flickr.com".

Comments and changes to this ticket

  • denis
  • denis

    denis November 12th, 2009 @ 12:00 PM

    I hate web editors without preview!

    I'll try one more time

       var u = new URI('http://api.flickr.com/services/feeds/photoset.gne?set=72157618136141827&nsid=15896232@N04&lang=en-us&format=atom');
       u.get('host') // "N04&lang=en-us&format=atom"
    
  • Sebastian Markbåge

    Sebastian Markbåge November 12th, 2009 @ 06:15 PM

    • State changed from “new” to “open”
    • Assigned user set to “Sebastian Markbåge”

    Having an @ character in the query string is not actually a correct URI. It needs to be encoded because @ is a reserved character. For this very purpose.

    But it should probably not try to parse it, raise an error or specially handle this case.

  • Aaron Newton

    Aaron Newton November 19th, 2009 @ 06:50 PM

    • Tag cleared.
    • Milestone set to backlog
  • denis

    denis November 20th, 2009 @ 02:24 AM

    Well, that URL is recognized properly by all browsers I tried. Such URL can be provided as input by user (e.g. by copy pasting it from a page).

    If URI class cannot parse it, it cannot parse a whole set of other urls (that may be not valid according to RFC, but practially valid otherwise). This makes URI class unusable for validating user input. Maybe its primary use-case is something else, in which case it's just unusable for me.

  • Sebastian Markbåge

    Sebastian Markbåge November 20th, 2009 @ 02:42 AM

    That's a good point.

    Some modern browsers decodes URLs for display in a more readable form. When it's used internally and sent over the wire, it is re-encoded into a proper URI. So there's a concept of sort of a UI URI and a formal URI. In that light, I think that perhaps it should be able to handle "UI URIs".

  • Scott Kyle

    Scott Kyle January 12th, 2010 @ 06:33 AM

    • Milestone cleared.
    • State changed from “open” to “resolved”
    • Assigned user changed from “Sebastian Markbåge” to “Scott Kyle”

    I adjusted the regex a bit

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

The MooTools Extensions

Pages