Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-9303

QUrl::fromUserInput behaves poorly when given an invalid input

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Won't Do
    • P3: Somewhat important
    • None
    • 4.6.0, 4.6.1, 4.6.2
    • Core: URL Handling
    • None

    Description

      I apologize that I may have placed this in too many Components above. I was not clear of one or two that applied, so I selected any that were close.

      I am reading from a database a URL that was entered by a human, and needs to be applied some fuzzy logic to try to determine what was meant. Specifically, anything a browser might try to "correct" the URL is what I want to try to correct, as it will be interpreted exactly by a browser.

      Upon the recent (4.6.x) existance of QUrl::fromUserInput(), I thought I would try that, as I was having a problem with the QUrl(QString) constructor doing "the wrong thing".

      I'm now getting a different wrong thing. If a URL has a hostname that is considered invalid (in my case, 'pictures..ie'), the "http://" prefix before it will be adapted into "http//", and then considered a hostname itself. So:

      Input argument 'google.com' produced URL 'google.com' via construction from QString, URL 'http://google.com' via fromUserInput.
      Input argument 'http://google..com' produced URL 'http:' via construction from QString, URL 'http://http//google..com' via fromUserInput.

      It would seem reasonable to attempt to collapse double-dots in hostnames within QUrl::fromUserInput().

      Thank you.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            cross Chris Ross
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes