Skip to content

xdg-open: handle file://localhost/

Presently, file://localhost/ URLs are totally unsupported: is_file_url_or_path correctly considers them files, but they are undecoded and hence check_input_file fails.

While the standardization surrounding file: URLs is admittedly vague [1], AFAIK, all literature, and other implementations, unambiguously demonstrate that file://localhost/ should be equivalent to file:///:

  • The "File URI specification" explicitly linked to from the xdg-utils homepage [2]
  • RFC 8089 section 1.1
  • RFC 1738 section 3.10
  • Observed implementations of Windows start, macOS open, Firefox, Chrome, IE

Fix this by adding some simple carve-outs for file://localhost specifically in file_url_to_path.

[1] https://lists.freedesktop.org/archives/xdg/2004-November/003711.html [2] https://edeproject.org/spec/file-uri-spec.txt

Signed-off-by: Richard Tollerton rich.tollerton@ni.com

Merge request reports