Details
-
Bug
-
Resolution: Won't Do
-
Not Evaluated
-
None
-
6.5.3
-
None
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.