Package: xdg-utils
Version: 1.1.0-1
xdg-open doesn't handle whitespaces properly in certain cases. For example:
> xdg-open foo\ .bar
xdg-open: 522: local: .bar: bad variable name
After fixing the missing quotes on L522 we stumble to another problem:
> xdg-open foo\ .bar
xdg-open: 783: local: .bar: bad variable name
Which can be fixed with a preceding IFS="".
Also the mime filetype check fails because it uses wrong (old, no longer
used) variable $file_check.
Proposed changes:
--- xdg-open.orig 2015-10-04 23:11:37.000000000 +0300
+++ xdg-open 2015-10-05 19:32:17.167430569 +0300
@@ -519,7 +519,7 @@
# If not, leave it as it is.
file_url_to_path()
{
- local file=$1
+ local file="$1"
if echo "$file" | grep -q '^file:///'; then
file=${file#file://}
file=${file%%#*}
@@ -779,13 +779,14 @@
open_generic()
{
+ IFS=""
if is_file_url_or_path "$1"; then
local file=$(file_url_to_path "$1")
check_input_file "$file"
if [ -n "$DISPLAY" ]; then
- filetype=`xdg-mime query filetype "$file_check" | sed "s/;.*//"`
+ filetype=`xdg-mime query filetype "$file" | sed "s/;.*//"`
open_generic_xdg_mime "$file" "$filetype"
fi