diff --git a/internal/updater/service.go b/internal/updater/service.go index 1a5daea..59e424d 100644 --- a/internal/updater/service.go +++ b/internal/updater/service.go @@ -98,15 +98,24 @@ func (u *UpdateService) CheckForUpdate() (*UpdateInfo, error) { } defer resp.Body.Close() + body, err := io.ReadAll(resp.Body) + if err != nil { + return nil, fmt.Errorf("read package API response: %w", err) + } + + slog.Info("package API response", "status", resp.StatusCode, "body", string(body)[:min(len(body), 500)]) + if resp.StatusCode != http.StatusOK { - return nil, fmt.Errorf("unexpected status %d from package API", resp.StatusCode) + return nil, fmt.Errorf("unexpected status %d from package API: %s", resp.StatusCode, string(body)) } var versions []giteaPackageVersion - if err := json.NewDecoder(resp.Body).Decode(&versions); err != nil { + if err := json.Unmarshal(body, &versions); err != nil { return nil, fmt.Errorf("decode package versions: %w", err) } + slog.Info("parsed versions", "count", len(versions), "currentVersion", u.currentVersion) + if len(versions) == 0 { slog.Info("no package versions found") return info, nil