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