From 486475db78b645e0e4db606fffd8cd5aa9af3316 Mon Sep 17 00:00:00 2001 From: Christoph Holtermann Date: Fri, 9 May 2025 20:23:21 +0200 Subject: [PATCH] check for http.statusOK 200 when downloading --- bridge/helper/helper.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bridge/helper/helper.go b/bridge/helper/helper.go index b90c906550..e1ef8a80d6 100644 --- a/bridge/helper/helper.go +++ b/bridge/helper/helper.go @@ -43,6 +43,10 @@ func DownloadFileAuth(url string, auth string) (*[]byte, error) { return nil, err } defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + peek, _ := io.ReadAll(resp.Body) + return nil, fmt.Errorf("unexpected HTTP status: %s, body: %.100s", resp.Status, peek) + } io.Copy(&buf, resp.Body) data := buf.Bytes() return &data, nil