From 3a1492ec4f3399f16a47733feffc2003287f9e4f Mon Sep 17 00:00:00 2001 From: Ondrej Holy Date: Thu, 3 Oct 2019 14:44:57 +0200 Subject: [PATCH] gio: Fix completion of URIs without hostname part Currently, "gio list file:///h" doesn't complete "file:///home" because the result of "dirname file:///h" is not "file:///" but "file:/", which breaks the consequent logic. Let's subtract basename from the path in order to workaround this issue. --- gio/completion/gio | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gio/completion/gio b/gio/completion/gio index 86a90e585..1e6ef7e8d 100644 --- a/gio/completion/gio +++ b/gio/completion/gio @@ -43,7 +43,8 @@ __gio_location() { if [[ $cur =~ "/"$ ]]; then dir="$cur" elif [[ $cur =~ "/" ]]; then - dir="$(dirname "$cur")/" + # Subtract basename because dirname cmd doesn't work well with schemes + dir=${cur%$(basename "$cur")} fi # List daemon mounts, just if dir is not specified, or looks like scheme