From f57196ef14fba0b8f6fae3931c7cb1c3f78c0a80 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Thu, 19 Jun 2025 20:48:51 +0200 Subject: [PATCH] fix: checkk url --- lib/utils.bash | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/utils.bash b/lib/utils.bash index cc716cb..ca1d82e 100644 --- a/lib/utils.bash +++ b/lib/utils.bash @@ -48,7 +48,7 @@ sort_versions() { fetch_all_assets() { curl -s -H "Accept: application/vnd.github.v3+json" \ https://api.github.com/repos/${GH_REPO}/releases | - jq -r '.[0].assets[] | "\(.name) \(.browser_download_url)"' + jq -r '.assets[] | "\(.name) \(.browser_download_url)"' } validate_platform() { @@ -114,9 +114,11 @@ download_release() { validate_platform # TODO: split output without piping to awk - url=$(fetch_all_assets | - grep "^${toolname}-${version}_${USE_PLATFORM}\s" | - awk '{print $2}') + url=$(fetch_all_assets | grep "^${toolname}-${version}_${USE_PLATFORM}\s" | awk '{print $2}') + + if [ -z "$url" ]; then + fail "No release asset found for ${toolname} ${version} on ${USE_PLATFORM}. Check asset name and presence." + fi ( cd "${ASDF_DOWNLOAD_PATH}" || exit 1