Package: xdg-utils
Version: 1.1.0~rc3+git20150922-1

xdg-open breaks if the filename has # or ? in the filename. Example:

        > xdg-open foo\#bar
        xdg-open: file 'foo' does not exist
        > xdg-open foo\?bar
        xdg-open: file 'foo' does not exist

This is caused at L744-L745:

        file_check=${file%%#*}
        file_check=${file_check%%\?*}

This might be the proper behaviour if the filename is an url (ie. file:///foo\#bar -> /foo) but in that case it should be inside the preceding if clause 'decoding urls'.


--- xdg-open.orig   2015-09-22 11:20:40.000000000 +0300
+++ xdg-open        2015-09-28 14:10:04.076625522 +0300
@@ -731,6 +731,7 @@
         ! echo "$1" | egrep -q '^[[:alpha:]+\.\-]+:'); then

         local file="$1"
+        file_check="$file"

         # 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')")"
+            file_check=${file%%#*}
+            file_check=${file_check%%\?*}
         fi
-        file_check=${file%%#*}
-        file_check=${file_check%%\?*}
         check_input_file "$file_check"

         if [ -n "$DISPLAY" ]; then

Reply via email to