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

This commit is contained in:
zhengkunwang 2024-08-14 18:29:59 +08:00 committed by GitHub
parent a85d5bad46
commit dca3c92d72
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

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

View File

@ -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