mirror of
https://github.com/ovh/the-bastion.git
synced 2025-09-13 00:14:18 +08:00
fix: install.inc: fail nicely on invalid JSON under set -e
This commit is contained in:
parent
11e81614a4
commit
2f623dfb3a
1 changed files with 1 additions and 1 deletions
|
@ -70,7 +70,7 @@ set_download_url() {
|
||||||
|
|
||||||
if command -v jq >/dev/null; then
|
if command -v jq >/dev/null; then
|
||||||
# If we have jq, we can do it properly
|
# If we have jq, we can do it properly
|
||||||
urls="$(jq -r '.[0].assets|.[]|.browser_download_url' < "$payload")"
|
urls="$(jq -r '.[0].assets|.[]|.browser_download_url' < "$payload" || true)"
|
||||||
elif perl -MJSON -e 1 2>/dev/null; then
|
elif perl -MJSON -e 1 2>/dev/null; then
|
||||||
# If we don't, there's a good chance we have Perl with the JSON module, use it
|
# If we don't, there's a good chance we have Perl with the JSON module, use it
|
||||||
urls="$(perl -MJSON -e 'undef $/; $d=decode_json(<>); exit if ref $d ne "ARRAY"; foreach(@{ $d->[0]{assets} || [] }) { print $_->{browser_download_url}."\n" }' "$payload")"
|
urls="$(perl -MJSON -e 'undef $/; $d=decode_json(<>); exit if ref $d ne "ARRAY"; foreach(@{ $d->[0]{assets} || [] }) { print $_->{browser_download_url}."\n" }' "$payload")"
|
||||||
|
|
Loading…
Add table
Reference in a new issue