mirror of
https://github.com/dehydrated-io/dehydrated.git
synced 2026-04-25 01:38:28 +02:00
don't fail on nested json array in challenge info
This commit is contained in:
@@ -651,14 +651,14 @@ sign_csr() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
challenges="$(printf '%s\n' "${response}" | sed -n 's/.*\("challenges":[^\[]*\[[^]]*]\).*/\1/p')"
|
challenges="$(printf '%s\n' "${response}" | sed -n 's/.*\("challenges":[^\[]*\[[^]]*]\).*/\1/p')"
|
||||||
repl=$'\n''{' # fix syntax highlighting in Vim
|
challenge="$(<<<"${challenges}" _sed -e 's/^[^\[]+\[(.+)\]$/\1/' -e 's/\}(, (\{)|(\]))/}\'$'\n''\2/g' | grep \""${CHALLENGETYPE}"\")"
|
||||||
challenge="$(printf "%s" "${challenges//\{/${repl}}" | grep \""${CHALLENGETYPE}"\")"
|
|
||||||
challenge_token="$(printf '%s' "${challenge}" | get_json_string_value token | _sed 's/[^A-Za-z0-9_\-]/_/g')"
|
challenge_token="$(printf '%s' "${challenge}" | get_json_string_value token | _sed 's/[^A-Za-z0-9_\-]/_/g')"
|
||||||
if [[ ${API} -eq 1 ]]; then
|
if [[ ${API} -eq 1 ]]; then
|
||||||
challenge_uri="$(printf '%s' "${challenge}" | get_json_string_value uri)"
|
challenge_uri="$(printf '%s' "${challenge}" | get_json_string_value uri)"
|
||||||
else
|
else
|
||||||
challenge_uri="$(printf '%s' "${challenge}" | get_json_string_value url)"
|
challenge_uri="$(printf '%s' "${challenge}" | get_json_string_value url)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "${challenge_token}" ]] || [[ -z "${challenge_uri}" ]]; then
|
if [[ -z "${challenge_token}" ]] || [[ -z "${challenge_uri}" ]]; then
|
||||||
_exiterr "Can't retrieve challenges (${response})"
|
_exiterr "Can't retrieve challenges (${response})"
|
||||||
|
|||||||
Reference in New Issue
Block a user