diff options
author | Minteck <nekostarfan@gmail.com> | 2021-11-14 19:09:34 +0000 |
---|---|---|
committer | Minteck <nekostarfan@gmail.com> | 2021-11-14 19:09:34 +0000 |
commit | 4fa28842044d48626b51c94a67ccf623d9a9383f (patch) | |
tree | 052f1d0622ec06a3c8ef14f738fe23b39cafa41c /preprocessor/url.sh | |
parent | d13afb20bac0b682f7e42c9655bc2af65aa9784a (diff) | |
download | bashweb-4fa28842044d48626b51c94a67ccf623d9a9383f.tar.gz bashweb-4fa28842044d48626b51c94a67ccf623d9a9383f.tar.bz2 bashweb-4fa28842044d48626b51c94a67ccf623d9a9383f.zip |
Commit
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 |