commit: 5a6a613f119276fd8e0a42e048e8e720c8e82de4
parent 75371d2aa236bccbf3127d8c85cf1cfec79b9217
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Wed, 4 Nov 2020 09:48:00 +0100
server.sh: Escape space
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/server.sh b/server.sh
@@ -12,6 +12,7 @@ IFS=#'
query="${line#gemini://*/}"
query="${query%%../*}"
+query="${query//%20/ }"
path="$GEMDIR/${query:-index.gmi}"
status="--"
@@ -32,7 +33,7 @@ then
status="20"
printf '20 text/gemini; charset=utf-8\r\n'
printf '# Index of %s\n' "$query"
- ls "${path}" | sed 's/^/=> /' 2>/dev/null
+ ls "${path}" | sed -e 's/ /%20/g' -e 's/^/=> /' 2>/dev/null
else
status="50"
printf '50 File not readable or non-existent\r\n'