Skip to content

Commit

Permalink
catch non-success HTTP codes on GitHub URL retrieval
Browse files Browse the repository at this point in the history
  • Loading branch information
jay0lee authored Dec 12, 2024
1 parent bb922dc commit 2ea6f77
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/gam-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,6 @@ else
fi
}

reverse() {
for (( i = ${#*}; i > 0; i-- ))
{
echo ${!i}
}
}

if [ "$gamversion" == "latest" ]; then
release_url="https://api.github.com/repos/GAM-team/GAM/releases/latest"
elif [ "$gamversion" == "prerelease" -o "$gamversion" == "draft" ]; then
Expand All @@ -126,9 +119,16 @@ release_json=$(curl \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"$release_url" \
2>&1 /dev/null)
--fail-with-body)
curl_exit_code=$?
if [ $curl_exit_code -ne 0 ]; then
echo_red "ERROR retrieving URL: ${release_json}"
exit
else
echo_green "done"
fi

echo_yellow "Getting file and download URL..."
echo_yellow "Calculating download URL for this device..."
# Python is sadly the nearest to universal way to safely handle JSON with Bash
# At least this code should be compatible with just about any Python version ever
# unlike GAM itself. If some users don't have Python we can try grep / sed / etc
Expand Down

0 comments on commit 2ea6f77

Please sign in to comment.