From 17dad3448ae2ac627cc10129ee42c714d9912444 Mon Sep 17 00:00:00 2001 From: Didier BONNEFOI Date: Tue, 15 Dec 2020 14:49:09 +0100 Subject: [PATCH] OvhRequestApi: Ensure to escape querystring arguments - [MAJOR] previously, only the first querystring argument was sent to OVH API, because ampersand was interpreted as shell background job, so other arguments ignored misc: - [MINOR] fix jsonsh-lib about AWK pattern warning --- contrib/jsonsh-lib.sh | 2 +- contrib/ovh-api-lib.sh | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/contrib/jsonsh-lib.sh b/contrib/jsonsh-lib.sh index 755d651..63f8e9c 100644 --- a/contrib/jsonsh-lib.sh +++ b/contrib/jsonsh-lib.sh @@ -114,7 +114,7 @@ _JSonSH_rewrite_output() ## Actions on json key : # 1) remove some chars : brackets and double quotes - gsub(/\[|\]|\"/,"",json_key) + gsub(/\[|\]|"/,"",json_key) # 2) detect array index between comma, put digits between brackets json_key = gensub(/(,([[:digit:]]+)(,|))/,"[\\2]\\3","g",json_key) # 3) replace each comma with dot diff --git a/contrib/ovh-api-lib.sh b/contrib/ovh-api-lib.sh index 34f076d..8bd141c 100644 --- a/contrib/ovh-api-lib.sh +++ b/contrib/ovh-api-lib.sh @@ -54,6 +54,8 @@ OvhRequestApi() cmd_profile=${cmd[*]} if [ -n "${url}" ]; then + # escape querystring arguments + url=$(printf "%q" "${url}") cmd+=(--url "${url}") fi