From dd5993d7abc726358a734d7b0951bdd3985d1419 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Fri, 5 Dec 2025 23:09:20 +0100 Subject: [PATCH] fix(tools.func): handle GitHub 300 Multiple Choices in tarball mode (#9697) --- misc/tools.func | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/misc/tools.func b/misc/tools.func index 5895141b59..5c031df2bf 100644 --- a/misc/tools.func +++ b/misc/tools.func @@ -1735,12 +1735,13 @@ function fetch_and_deploy_gh_release() { ### Tarball Mode ### if [[ "$mode" == "tarball" || "$mode" == "source" ]]; then - url=$(echo "$json" | jq -r '.tarball_url // empty') - [[ -z "$url" ]] && url="https://github.com/$repo/archive/refs/tags/v$version.tar.gz" + # GitHub API's tarball_url/zipball_url can return HTTP 300 Multiple Choices + # when a branch and tag share the same name. Use explicit refs/tags/ URL instead. + local direct_tarball_url="https://github.com/$repo/archive/refs/tags/$tag_name.tar.gz" filename="${app_lc}-${version}.tar.gz" - curl $download_timeout -fsSL -o "$tmpdir/$filename" "$url" || { - msg_error "Download failed: $url" + curl $download_timeout -fsSL -o "$tmpdir/$filename" "$direct_tarball_url" || { + msg_error "Download failed: $direct_tarball_url" rm -rf "$tmpdir" return 1 }