Package: xdg-utils
Version: 1.1.0~rc1+git20111210-7.4
Severity: important
Tags: patch

Dear Maintainer,

I use calibre for organizing my perosnal ebook library. Calibre
store ebooks in filenames containing spaces (plus possibly special
characters) and uses xdg-open to open these ebooks.

Unfortunately, under lxde, any attempt to open any of these ebooks fails
with a message (from pcmanfm, I suppose) such as
"/home/judicael/calibre/John%20Doe/A%20book.pdf: Aucun fichier ou
dossier de ce type" (i.e. "...: No such file or directory").

According to
http://www.mobileread.com/forums/showpost.php?p=2724944&postcount=15
the problem lies in the open_lxde function.

Indeed, if I patch it with the code from open_generic, it works
perfectly. Here is the patch, could you apply it to the debian version
or forward it upstream?

----------------------------------------------------------------------
--- /usr/bin/xdg-open   2015-02-20 16:30:32.000000000 +0100
+++ /home/judicael/scripts/xdg-open     2016-12-20 16:12:42.359019656 +0100
@@ -676,14 +676,22 @@
 open_lxde()
 {
     # pcmanfm only knows how to handle file:// urls and filepaths, it seems.
     if (echo "$1" | grep -q '^file://' ||
         ! echo "$1" | egrep -q '^[[:alpha:]+\.\-]+:')
     then
-        local file="$(echo "$1" | sed 's%^file://%%')"
-
+        local file="$1"
+        # Decode URLs
+        if echo "$file" | grep -q '^file:///'; then
+            file=${file#file://}
+            local printf=printf
+            if [ -x /usr/bin/printf ]; then
+                printf=/usr/bin/printf
+            fi
+            file="$($printf "$(echo "$file" | sed -e 
's@%\([a-f0-9A-F]\{2\}\)@\\x\1@g')")"
+        fi
         # handle relative paths
         if ! echo "$file" | grep -q '^/'; then
             file="$(pwd)/$file"
         fi
 
         pcmanfm "$file"
----------------------------------------------------------------------

Yours,

J. Courant.

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

Kernel: Linux 3.16.0-4-amd64 (SMP w/8 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

xdg-utils depends on no packages.

Versions of packages xdg-utils recommends:
ii  libfile-mimeinfo-perl  0.26-1
ii  libnet-dbus-perl       1.0.0-2+b2
ii  libx11-protocol-perl   0.56-6
ii  x11-utils              7.7+2
ii  x11-xserver-utils      7.7+3+b1

Versions of packages xdg-utils suggests:
pn  gvfs-bin  <none>

-- no debconf information

Reply via email to