dot

packages and services management
Log | Files | Refs | README

commit 72107e37f79d8cbba4b052ecb8c1ad552daf7b28
parent 4e58838e1951cee2efd1958c5a9caf8b435b7ff3
Author: Josuah Demangeon <mail@josuah.net>
Date:   Tue,  5 Dec 2017 13:11:40 +0100

fixing uri parsing

Diffstat:
Mbin/uri | 2++
Mbin/xdg-open | 4+++-
2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/bin/uri b/bin/uri @@ -32,6 +32,8 @@ $(printf %s "$1" | awk '{ if (sub("^:[0-9]+:", "", $0) > 0 || sub("^:[0-9]+/", "/", $0) > 0) { sub(":", "", port); sub("[:/].*", "", port); + } else if (sub("^:[0-9]+$", "", $0) > 0) { + sub(":", "", port); } else { port = "."; } diff --git a/bin/xdg-open b/bin/xdg-open @@ -49,6 +49,8 @@ $(printf %s "$1" | awk '{ if (sub("^:[0-9]+:", "", $0) > 0 || sub("^:[0-9]+/", "/", $0) > 0) { sub(":", "", port); sub("[:/].*", "", port); + } else if (sub("^:[0-9]+$", "", $0) > 0) { + sub(":", "", port); } else { port = "."; } @@ -76,7 +78,7 @@ case $scheme in ;; (ssh) address=${1#*://} - address=${address%*:} + address=${address%:*} if [ "$port" = . ] then exec ssh "$address" else exec ssh -p "$port" "$address"