commit 4c43519e04e5fea640910fbb9e1cacab6d81ea6b
parent 31a472a95d0fd1de0e9d45de5efb87b2ebe72862
Author: blmayer <bleemayer@gmail.com>
Date: Wed, 18 Aug 2021 19:08:54 -0300
Improved relative link parsing
Diffstat:
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/astro b/astro
@@ -55,9 +55,9 @@ $(echo "$1" | sed -E 's@^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))
EOF
[ "$debug" ] && echo "Parsed URL: proto: $proto host: $hostport path: $path" >&2 && sleep 2
- if [ "$oldhost" ] && [ "$hostport" = "" ]
+ if [ "$oldhost" ] && [ "${hostport// /}" = "" ]
then
- hostport="$host"
+ hostport="$oldhost"
elif [ "$hostport" = "" ]
then
hostport="${path%%/}"
@@ -72,8 +72,9 @@ EOF
if [ "$oldhost" = "$host" ]
then
: "${oldpath:=}"
- case "$oldpath" in
- *"/") path="$oldpath$path" ;;
+ case "$path" in
+ "/"*) ;;
+ *) path="$oldpath$path" ;;
esac
fi
[ "$debug" ] && echo "Response: proto: ${proto:-gemini} host: $host port: ${port:-1965} path: ${path#/}" >&2 && sleep 2