From 515f3b36950ce02a0c1838bc9df5dd68e32ddb52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=99=AF=E9=98=B3?= <1656488874@qq.com> Date: Tue, 7 Jan 2020 01:32:11 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E5=89=8D=E7=AB=AF=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/conf/config.yml | 2 +- backend/routes/system.go | 1 + backend/services/system.go | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/conf/config.yml b/backend/conf/config.yml index 9fb0dee5..6f8652f8 100644 --- a/backend/conf/config.yml +++ b/backend/conf/config.yml @@ -34,7 +34,7 @@ spider: task: workers: 4 other: - tmppath: "/tmp" + tmppath: "./tmp" version: 0.4.3 setting: allowRegister: "N" diff --git a/backend/routes/system.go b/backend/routes/system.go index b4e130a9..8c443d2a 100644 --- a/backend/routes/system.go +++ b/backend/routes/system.go @@ -259,6 +259,7 @@ func GetDepJson(c *gin.Context) { _dep, err := services.FetchPythonDepInfo(depName) if err != nil { HandleError(http.StatusInternalServerError, c, err) + return } dep = _dep } else { diff --git a/backend/services/system.go b/backend/services/system.go index 12b8744c..6181afee 100644 --- a/backend/services/system.go +++ b/backend/services/system.go @@ -251,6 +251,9 @@ func FetchPythonDepInfo(depName string) (entity.Dependency, error) { return entity.Dependency{}, err } var data PythonDepJsonData + if res.Response().StatusCode == 404 { + return entity.Dependency{}, errors.New("get depName from [https://pypi.org] error: 404") + } if err := res.ToJSON(&data); err != nil { log.Errorf(err.Error()) debug.PrintStack()