diff options
Diffstat (limited to 'preprocessor/url.sh')
-rwxr-xr-x | preprocessor/url.sh | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/preprocessor/url.sh b/preprocessor/url.sh index bc4e221..1c04b90 100755 --- a/preprocessor/url.sh +++ b/preprocessor/url.sh @@ -1,4 +1,12 @@ #!/bin/bash -read_from_pipe() { read "$@" <&0; } +url=$1 -echo "$(read_from_pipe | head -1)" +if [[ "$url" =~ .*"..".* ]]; then + url="/" +fi + +if [ -f "./public/$url/index.bhtml" ]; then + url="/$url/index.bhtml" +fi + +echo $url |