mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-04-25 11:25:05 +02:00
fix(tools): prevent script crash when entering GitHub token after rate limit
fetch_and_deploy_gh_release set attempt=0 after accepting a token, then immediately ran ((0++)) which evaluates to 0 (falsy) causing exit code 1 and killing the script under set -e. Fix: set attempt=1 and continue to restart the retry loop cleanly, giving the full max_retries budget with the new token. Also fix fetch_and_deploy_codeberg_release: replace ((attempt++)) with attempt=\ to avoid the same zero-evaluation crash on the first connection timeout (attempt starts at 0 in that loop). Fixes #13635
This commit is contained in:
@@ -2860,7 +2860,7 @@ function fetch_and_deploy_codeberg_release() {
|
||||
|
||||
while ((attempt < ${#api_timeouts[@]})); do
|
||||
resp=$(curl --connect-timeout 10 --max-time "${api_timeouts[$attempt]}" -fsSL -w "%{http_code}" -o /tmp/codeberg_rel.json "$api_url") && success=true && break
|
||||
((attempt++))
|
||||
attempt=$((attempt + 1))
|
||||
if ((attempt < ${#api_timeouts[@]})); then
|
||||
msg_warn "API request timed out after ${api_timeouts[$((attempt - 1))]}s, retrying... (attempt $((attempt + 1))/${#api_timeouts[@]})"
|
||||
fi
|
||||
@@ -3370,7 +3370,8 @@ function fetch_and_deploy_gh_release() {
|
||||
if prompt_for_github_token; then
|
||||
header=(-H "Authorization: token $GITHUB_TOKEN")
|
||||
retry_delay=2
|
||||
attempt=0
|
||||
attempt=1
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user