* another router fix, for real this time

merge-requests/2/head
Dominika Liberda 2021-08-02 22:37:27 +00:00
parent 4e49582099
commit 2639361804
2 changed files with 2 additions and 2 deletions

View File

@ -4,6 +4,6 @@
# router(uri, path)
function router() {
route+=("$1")
route+=("$(sed -E 's/:[A-Za-z0-9]+/[A-Za-z0-9.,%:-_]+/g' <<< "$1")")
route+=("$(sed -E 's/:[A-Za-z0-9]+/[A-Za-z0-9.,%:\\-_]+/g' <<< "$1")")
route+=("$2")
}

View File

@ -123,8 +123,8 @@ echo "$(date) - IP: ${r[ip]}, PROTO: ${r[proto]}, URL: ${r[url]}, GET_data: ${ge
[[ -f "${cfg[namespace]}/routes.sh" ]] && source "${cfg[namespace]}/routes.sh"
if [[ ${r[status]} != 101 ]]; then
clean_url="$(sed -E 's/\?.*//' <<< "${r[url]}")"
for (( i=0; i<${#route[@]}; i=i+3 )); do
clean_url="$(grep -Poh '.*?\?' <<< "${r[url]}")"
if [[ "$(grep -Poh "^${route[$((i+1))]}$" <<< "$clean_url")" != "" ]] || [[ "$(grep -Poh "^${route[$((i+1))]}$" <<< "$clean_url/")" != "" ]]; then
r[status]=212
r[view]="${route[$((i+2))]}"