Bug#973798: xdg-utils: xdg-open fails to open file://localhost/xxx URLs

Francois Gouget fgouget at free.fr
Thu Nov 5 09:46:12 GMT 2020


Package: xdg-utils
Version: 1.1.3-2
Severity: normal
Tags: patch

Dear Maintainer,

$ echo Hello >/tmp/foo.html
$ xdg-open file://localhost/tmp/foo.html
Unable to run the command specified. The file or folder //localhost/tmp/foo.html does not exist.
$ xdg-open file:///tmp/foo.html
-> open foo.html as expected.

Normally file:///tmp/foo.html and file://localhost/tmp/foo.html are
equivalent URLs.

Note that this is fixed upstream in the commit below:

commit 186966735dcccd61afde937118f27043bd084f57
Author: Richard Tollerton <rich.tollerton at ni.com>
Date:   Thu Jan 10 15:41:08 2019 -0600

    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 at ni.com>


-- Package-specific info:
Desktop environment: XDG_CURRENT_DESKTOP=KDE

-- System Information:
Debian Release: 10.6
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.19.0-11-amd64 (SMP w/8 CPU cores)
Kernel taint flags: TAINT_WARN, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE=fr:en_US (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

xdg-utils depends on no packages.

Versions of packages xdg-utils recommends:
ii  libfile-mimeinfo-perl  0.29-1
ii  libnet-dbus-perl       1.1.0-5+b1
ii  libx11-protocol-perl   0.56-7
ii  x11-utils              7.7+4
ii  x11-xserver-utils      7.7+8

xdg-utils suggests no packages.

-- no debconf information



More information about the Pkg-freedesktop-maintainers mailing list