--- a/xdg-open 2016-05-01 14:08:51.082243681 +1000 +++ b/xdg-open 2016-05-02 09:50:36.996106844 +1000 @@ -700,7 +700,7 @@ replaced=1 arg="$target" shift - set -- "$@" "$arg" + [ -n "$arg" ] && set -- "$@" "$arg" ;; %[i]) replaced=1 @@ -756,9 +756,15 @@ open_generic_xdg_x_scheme_handler() { scheme="`echo $1 | sed -n 's/\(^[[:alnum:]+\.-]*\):.*$/\1/p'`" + path="`echo $1 | sed -nr 's/^[[:alnum:]+\.-]+:\/*//p'`" if [ -n $scheme ]; then filetype="x-scheme-handler/$scheme" - open_generic_xdg_mime "$1" "$filetype" + # check if it's actually a url or just a scheme + if [ -n "$path" ]; then + open_generic_xdg_mime "$1" "$filetype" + else + open_generic_xdg_mime "" "$filetype" + fi fi }