fix(tools.func): handle GitHub 300 Multiple Choices in tarball mode (#9697)
This commit is contained in:
parent
0c2521c05e
commit
dd5993d7ab
@ -1735,12 +1735,13 @@ function fetch_and_deploy_gh_release() {
|
|||||||
|
|
||||||
### Tarball Mode ###
|
### Tarball Mode ###
|
||||||
if [[ "$mode" == "tarball" || "$mode" == "source" ]]; then
|
if [[ "$mode" == "tarball" || "$mode" == "source" ]]; then
|
||||||
url=$(echo "$json" | jq -r '.tarball_url // empty')
|
# GitHub API's tarball_url/zipball_url can return HTTP 300 Multiple Choices
|
||||||
[[ -z "$url" ]] && url="https://github.com/$repo/archive/refs/tags/v$version.tar.gz"
|
# 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"
|
filename="${app_lc}-${version}.tar.gz"
|
||||||
|
|
||||||
curl $download_timeout -fsSL -o "$tmpdir/$filename" "$url" || {
|
curl $download_timeout -fsSL -o "$tmpdir/$filename" "$direct_tarball_url" || {
|
||||||
msg_error "Download failed: $url"
|
msg_error "Download failed: $direct_tarball_url"
|
||||||
rm -rf "$tmpdir"
|
rm -rf "$tmpdir"
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user