Browse Source

fix: 解决 PHP 运行环境版本过期之后下载安装包失败的问题 (#6125)

pull/6136/head
zhengkunwang 3 months ago committed by GitHub
parent
commit
dca3c92d72
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      backend/app/service/app.go
  2. 4
      backend/utils/http/request.go

2
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
}
}

4
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

Loading…
Cancel
Save