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

QUrl Incorrectly Parses Custom `addressbook://` Scheme as Requiring a Hostname

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Not Evaluated
    • None
    • 6.5.3
    • Core: URL Handling
    • None
    • macOS

    Description

      Description:
      `QUrl` incorrectly handles URLs with the `addressbook://` scheme by enforcing a hostname validation, which leads to an error when parsing the URL. The `addressbook://` scheme is used by macOS for its internal Contacts app and does not require a hostname, yet `QUrl` treats the UUID-like portion of the URL as a hostname and throws an "Invalid hostname" error.

      Steps to reproduce:
      1. Create a `QUrl` object with the following URL:

      QUrl url("addressbook://8C070348-9958-4C19-B5CF-526DFEEAB0DE%3AABPerson");
      

      2. Observe that `QUrl` is invalid and reports the following error:

      Invalid hostname (contains invalid characters); source was "addressbook://8C070348-9958-4C19-B5CF-526AFGEAB0DE%3AABPerson"; scheme = "addressbook", host = ""
      

      Not percent encoding the id gives:

      Invalid port or port number out of range; source was "addressbook://8C070348-9958-4C19-B5CF-526ASEEAB0DE:ABPerson"; scheme = "addressbook", host = "8c070348-9958-4c19-b5cf-526afeeab0de"
      

      Expected behavior:
      `QUrl` should correctly handle custom schemes like `addressbook://` without requiring a hostname. The portion after `addressbook://` in this case (`8C070348-9958-4C19-B5CF-526AFEEAB0DE%3AABPerson`) is a path or identifier, not a hostname.

      Actual behavior:
      `QUrl` incorrectly interprets the UUID portion as a hostname and throws an error about invalid characters (due to the colon `%3A` in the path). Custom URL schemes like `addressbook://` do not follow the standard hostname/path structure.

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            manuelschneid3r Manuel Schneider
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes