From b5320a169de9d24cdfbc07ccd1514db2a91b9566 Mon Sep 17 00:00:00 2001 From: sdomi Date: Sun, 9 Nov 2025 01:49:50 +0100 Subject: [PATCH] misc: http_array will make up an array when called on normal params --- src/misc.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/misc.sh b/src/misc.sh index c2ba819..6d6b7ac 100755 --- a/src/misc.sh +++ b/src/misc.sh @@ -111,7 +111,18 @@ _param_parse() { # http_array(name, out_ref) http_array() { [[ ! "$1" || ! "$2" ]] && return 1 - [[ ! "${http_array_refs[$1]}" ]] && return 1 + if [[ ! "${http_array_refs[$1]}" ]]; then + declare -ga $2 + local -n ref=$2 - declare -gn $2=${http_array_refs[$1]} + if [[ "${post_data[$1]}" ]]; then + ref=("${post_data[$1]}") + elif [[ "${get_data[$1]}" ]]; then + ref=("${get_data[$1]}") + else + return 1 + fi + else + declare -gn $2=${http_array_refs[$1]} + fi }