Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.8.2
-
None
-
-
31753e722 (dev), 5e936b60f (dev), 6deb5098a (6.9), de3cf05b7 (6.9), 52a5ac769 (6.8), 8f5e26f51 (6.8)
Description
When a URL contains square brackets, QMimeData, doesn't escape them when building a file URI for drag-and-drop data. The URL spec (RFC 3986) states that square brackets are always invalid in URLs except when used to enclose an IP address, so some strict URI parsers will reject file URIs containing them.
One liner demonstrating the issue:
python -c 'from PySide6.QtCore import QUrl, QMimeData; md = QMimeData(); md.setUrls([QUrl.fromLocalFile("/t e[st]")]); print(bytes(md.data("text/uri-list")).decode())' file:///t%20e[st]
We see that the space has been escaped as %20 but the ch[ and ]aracters have not been escaped.
This specifically causes problems on macOS because Apple's NSURL is
one of those strict URI implementations that will reject file URIs
with brackets.