From dca3c92d72b9d116d8afc18b900e83cb9ed8ad45 Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Wed, 14 Aug 2024 18:29:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=20PHP=20=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E7=8E=AF=E5=A2=83=E7=89=88=E6=9C=AC=E8=BF=87=E6=9C=9F?= =?UTF-8?q?=E4=B9=8B=E5=90=8E=E4=B8=8B=E8=BD=BD=E5=AE=89=E8=A3=85=E5=8C=85?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98=20(#6125)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/app.go | 2 +- backend/utils/http/request.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/app/service/app.go b/backend/app/service/app.go index b88050326..a674be94f 100644 --- a/backend/app/service/app.go +++ b/backend/app/service/app.go @@ -188,7 +188,7 @@ func (a AppService) GetAppDetail(appID uint, version, appType string) (response. versionPath := filepath.Join(app.GetAppResourcePath(), detail.Version) if !fileOp.Stat(versionPath) || detail.Update { - if err = downloadApp(app, detail, nil); err != nil { + if err = downloadApp(app, detail, nil); err != nil && !fileOp.Stat(versionPath) { return appDetailDTO, err } } diff --git a/backend/utils/http/request.go b/backend/utils/http/request.go index 6445ec8ef..3d3f9d8e2 100644 --- a/backend/utils/http/request.go +++ b/backend/utils/http/request.go @@ -2,6 +2,7 @@ package http import ( "context" + "errors" "io" "net/http" "time" @@ -35,6 +36,9 @@ func HandleGetWithTransport(url, method string, transport *http.Transport, timeo if err != nil { return 0, nil, err } + if resp.StatusCode != http.StatusOK { + return 0, nil, errors.New(resp.Status) + } body, err := io.ReadAll(resp.Body) if err != nil { return 0, nil, err