From 35d580287c4c01935f6bec10e317d59f088a7c3f Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Mon, 7 Apr 2025 09:31:39 +0200 Subject: [PATCH] Update install.func --- misc/install.func | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/misc/install.func b/misc/install.func index e77829e..a761ebd 100644 --- a/misc/install.func +++ b/misc/install.func @@ -282,22 +282,33 @@ get_gh_release() { local header=() local attempt=0 local max_attempts=3 - local api_response tag + local api_response tag http_code echo "🔍 Checking latest release for: $repo" [[ -n "${GITHUB_TOKEN:-}" ]] && header=(-H "Authorization: token $GITHUB_TOKEN") until [[ $attempt -ge $max_attempts ]]; do - ((attempt++)) + ((attempt++)) || true $STD msg_info "[$attempt/$max_attempts] Fetching GitHub release for $repo...\n" - if ! api_response=$(curl -fsSL "${header[@]}" "$api_url"); then - $STD msg_info "Request failed, retrying...\n" + # Hole HTTP-Status explizit + api_response=$(curl -fsSL -w "%{http_code}" -o /tmp/gh_resp.json "${header[@]}" "$api_url") + http_code="${api_response:(-3)}" + + if [[ "$http_code" == "404" ]]; then + msg_error "Repository $repo hat kein Release (404)" + return 1 + fi + + if [[ "$http_code" != "200" ]]; then + $STD msg_info "Request failed with HTTP $http_code, retrying...\n" sleep 2 continue fi + api_response=$(