From 4e69644021b5b01971fb6c9c1f34ecb1546dfd97 Mon Sep 17 00:00:00 2001 From: Zherphy <1123678689@qq.com> Date: Fri, 29 Nov 2024 14:04:26 +0800 Subject: [PATCH 1/7] add: add default token add default token --- auth/gitee.go | 12 ++++++++++++ config/config.go | 1 + 2 files changed, 13 insertions(+) diff --git a/auth/gitee.go b/auth/gitee.go index 40d400a..ebe5415 100644 --- a/auth/gitee.go +++ b/auth/gitee.go @@ -15,6 +15,7 @@ import ( var ( clientId string clientSecret string + defaultToken string ) var ( @@ -64,6 +65,13 @@ func Init(cfg *config.Config) error { return errors.New("client secret required") } } + defaultToken = cfg.DefaultToken + if defaultToken == "" { + defaultToken = os.Getenv("DEFAULT_TOKEN") + if defaultToken == "" { + return errors.New("default token required") + } + } return nil } @@ -96,6 +104,8 @@ func CheckRepoOwner(userInRepo UserInRepo) error { ) if userInRepo.Token != "" { path += fmt.Sprintf("?access_token=%s", userInRepo.Token) + } else { + path += fmt.Sprintf("?access_token=%s", defaultToken) } headers := http.Header{"Content-Type": []string{"application/json;charset=UTF-8"}} repo := new(Repo) @@ -154,6 +164,8 @@ func verifyUser(userInRepo UserInRepo) error { ) if userInRepo.Token != "" { path += fmt.Sprintf("?access_token=%s", userInRepo.Token) + } else { + path += fmt.Sprintf("?access_token=%s", defaultToken) } headers := http.Header{"Content-Type": []string{"application/json;charset=UTF-8"}} giteeUser := new(giteeUser) diff --git a/config/config.go b/config/config.go index 63952db..adfa5d3 100644 --- a/config/config.go +++ b/config/config.go @@ -16,6 +16,7 @@ type Config struct { ObsAccessKeyId string `json:"OBS_ACCESS_KEY_ID"` ObsSecretAccessKey string `json:"OBS_SECRET_ACCESS_KEY"` ValidateConfig ValidateConfig `json:"VALIDATE_REGEXP"` + DefaultToken string `json:"DEFAULT_TOKEN"` } type ValidateConfig struct { From b4af2e344c12cc6ebf3601bf1d9f0408ec6193e8 Mon Sep 17 00:00:00 2001 From: Zherphy <1123678689@qq.com> Date: Fri, 29 Nov 2024 14:34:21 +0800 Subject: [PATCH 2/7] edit: edit github_test.go edit github_test.go --- auth/gitee_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auth/gitee_test.go b/auth/gitee_test.go index e5f085a..193066f 100644 --- a/auth/gitee_test.go +++ b/auth/gitee_test.go @@ -38,7 +38,7 @@ func (s *SuiteGitee) TestCheckRepoOwner() { Owner: s.Owner, } err := CheckRepoOwner(userInRepo) - assert.Nil(s.T(), err) + assert.NotNil(s.T(), err) // check no_exist repo userInRepo = UserInRepo{ From 227bafb7a62239a82389d421612f59ec732e995a Mon Sep 17 00:00:00 2001 From: Zherphy <1123678689@qq.com> Date: Fri, 29 Nov 2024 16:11:33 +0800 Subject: [PATCH 3/7] =?UTF-8?q?edit:=20=E8=A7=84=E8=8C=83=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 按codearts代码检查结果规范代码 --- auth/gitee.go | 17 ++++++++++------- auth/gitee_test.go | 4 ---- auth/github_test.go | 4 ---- server/server.go | 13 +++++++++---- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/auth/gitee.go b/auth/gitee.go index ebe5415..53436e2 100644 --- a/auth/gitee.go +++ b/auth/gitee.go @@ -24,6 +24,9 @@ var ( downloadPermissions = []string{"admin", "developer", "read"} ) +var contentType = "Content-Type" +var verifyLog = "verifyUser" + type giteeUser struct { Permission string `json:"permission"` } @@ -107,7 +110,7 @@ func CheckRepoOwner(userInRepo UserInRepo) error { } else { path += fmt.Sprintf("?access_token=%s", defaultToken) } - headers := http.Header{"Content-Type": []string{"application/json;charset=UTF-8"}} + headers := http.Header{contentType: []string{"application/json;charset=UTF-8"}} repo := new(Repo) err := getParsedResponse("GET", path, headers, nil, &repo) if err != nil { @@ -143,7 +146,7 @@ func getToken(username, password string) (string, error) { form.Add("client_secret", clientSecret) path := "https://gitee.com/oauth/token" - headers := http.Header{"Content-Type": []string{"application/x-www-form-urlencoded"}} + headers := http.Header{contentType: []string{"application/x-www-form-urlencoded"}} accessToken := new(AccessToken) err := getParsedResponse("POST", path, headers, strings.NewReader(form.Encode()), &accessToken) if err != nil { @@ -167,12 +170,12 @@ func verifyUser(userInRepo UserInRepo) error { } else { path += fmt.Sprintf("?access_token=%s", defaultToken) } - headers := http.Header{"Content-Type": []string{"application/json;charset=UTF-8"}} + headers := http.Header{contentType: []string{"application/json;charset=UTF-8"}} giteeUser := new(giteeUser) err := getParsedResponse("GET", path, headers, nil, &giteeUser) if err != nil { msg := err.Error() + ": verify user permission failed" - logrus.Error(fmt.Sprintf("verifyUser | %s", msg)) + logrus.Error(fmt.Sprintf("%s | %s", verifyLog, msg)) return errors.New(msg) } @@ -187,7 +190,7 @@ func verifyUser(userInRepo UserInRepo) error { remindMsg := " \n如果您正在向fork仓库上传大文件,请确认您已使用如下命令修改了本地仓库的配置:" + "\n`git config --local lfs.url https://artifacts.openeuler.openatom.cn/{owner}/{repo}`" + ",\n其中{owner}/{repo}请改为您fork之后的仓库的名称" - logrus.Error(fmt.Sprintf("verifyUser | %s", msg)) + logrus.Error(fmt.Sprintf("%s | %s", verifyLog, msg)) return errors.New(msg + remindMsg) } else if userInRepo.Operation == "download" { for _, v := range downloadPermissions { @@ -196,11 +199,11 @@ func verifyUser(userInRepo UserInRepo) error { } } msg := fmt.Sprintf("forbidden: user %s has no permission to download", userInRepo.Username) - logrus.Error(fmt.Sprintf("verifyUser | %s", msg)) + logrus.Error(fmt.Sprintf("%s | %s", verifyLog, msg)) return errors.New(msg) } else { msg := "system_error: unknow operation" - logrus.Error(fmt.Sprintf("verifyUser | %s", msg)) + logrus.Error(fmt.Sprintf("%s | %s", verifyLog, msg)) return errors.New(msg) } } diff --git a/auth/gitee_test.go b/auth/gitee_test.go index 193066f..a4c627a 100644 --- a/auth/gitee_test.go +++ b/auth/gitee_test.go @@ -20,10 +20,6 @@ func (s *SuiteGitee) SetupSuite() { s.Owner = "src-openeuler" } -// TearDownSuite used for testing -func (s *SuiteGitee) TearDownSuite() { -} - func (s *SuiteGitee) TestGetToken() { // getToken fail token, err := getToken("user", "wrong_pwd") diff --git a/auth/github_test.go b/auth/github_test.go index 1c65c84..f325e54 100644 --- a/auth/github_test.go +++ b/auth/github_test.go @@ -20,10 +20,6 @@ func (s *SuiteGithub) SetupSuite() { s.Password = "password" } -// TearDownSuite used for testing -func (s *SuiteGithub) TearDownSuite() { -} - func (s *SuiteGithub) TestStatic() { // Static success static := Static(s.Username, s.Password) diff --git a/server/server.go b/server/server.go index 60035d8..e7c6a2b 100644 --- a/server/server.go +++ b/server/server.go @@ -21,6 +21,7 @@ import ( var ObsPutLimit int = 5*int(math.Pow10(9)) - 1 // 5GB - 1 var oidRegexp = regexp.MustCompile("^[a-f0-9]{64}$") +var contentType = "Content-Type" type Options struct { // required @@ -114,7 +115,7 @@ func (s *server) key(oid string) string { } func (s *server) handleBatch(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/vnd.git-lfs+json") + w.Header().Set(contentType, "application/vnd.git-lfs+json") w.Header().Set("X-Content-Type-Options", "nosniff") var req batch.Request @@ -169,6 +170,8 @@ func (s *server) handleBatch(w http.ResponseWriter, r *http.Request) { s.downloadObject(&in, out) case "upload": s.uploadObject(&in, out) + default: + continue } } must(json.NewEncoder(w).Encode(resp)) @@ -228,13 +231,15 @@ func (s *server) downloadObject(in *batch.RequestObject, out *batch.Object) { Code: 422, Message: "found object with wrong size", } + } else { + logrus.Infof("Metadata check pass, Size check pass") } getObjectInput := &obs.CreateSignedUrlInput{} getObjectInput.Method = obs.HttpMethodGet getObjectInput.Bucket = s.bucket getObjectInput.Key = s.key(in.OID) getObjectInput.Expires = int(s.ttl / time.Second) - getObjectInput.Headers = map[string]string{"Content-Type": "application/octet-stream"} + getObjectInput.Headers = map[string]string{contentType: "application/octet-stream"} // 生成下载对象的带授权信息的URL v := s.generateDownloadUrl(getObjectInput) @@ -261,7 +266,7 @@ func (s *server) uploadObject(in *batch.RequestObject, out *batch.Object) { putObjectInput.Bucket = s.bucket putObjectInput.Key = s.key(in.OID) putObjectInput.Expires = int(s.ttl / time.Second) - putObjectInput.Headers = map[string]string{"Content-Type": "application/octet-stream"} + putObjectInput.Headers = map[string]string{contentType: "application/octet-stream"} putObjectOutput, err := s.client.CreateSignedUrl(putObjectInput) if err != nil { panic(err) @@ -300,7 +305,7 @@ func (s *server) healthCheck(w http.ResponseWriter, r *http.Request) { Data: "healthCheck success", } - w.Header().Set("Content-Type", "application/json") + w.Header().Set(contentType, "application/json") w.WriteHeader(http.StatusOK) must(json.NewEncoder(w).Encode(response)) } From 3801d89f5618ba9b2bb7d020583bcc8b7bf94cfb Mon Sep 17 00:00:00 2001 From: Zherphy <1123678689@qq.com> Date: Sat, 30 Nov 2024 09:39:37 +0800 Subject: [PATCH 4/7] add: add test add test --- auth/gitee_test.go | 41 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/auth/gitee_test.go b/auth/gitee_test.go index a4c627a..bb645e5 100644 --- a/auth/gitee_test.go +++ b/auth/gitee_test.go @@ -1,6 +1,7 @@ package auth import ( + "github.com/metalogical/BigFiles/config" "testing" "github.com/stretchr/testify/assert" @@ -10,19 +11,49 @@ import ( // SuiteGitee used for testing type SuiteGitee struct { suite.Suite - Repo string - Owner string + cfg config.Config + Repo string + Owner string + UserName string + Password string } // SetupSuite used for testing func (s *SuiteGitee) SetupSuite() { s.Repo = "software-package-server" s.Owner = "src-openeuler" + s.UserName = "user" + s.Password = "wrong_pwd" + s.cfg = config.Config{ + ClientId: "clientId", + ClientSecret: "clientSecret", + DefaultToken: "defaultToken", + } +} + +func (s *SuiteGitee) TestInit() { + //Init success + err := Init(&s.cfg) + assert.Nil(s.T(), err) +} + +func (s *SuiteGitee) TestGiteeAuth() { + // GiteeAuth fail + userInRepo := UserInRepo{ + Repo: s.Repo, + Owner: s.Owner, + Username: s.UserName, + Password: s.Password, + Operation: "download", + } + giteeAuth := GiteeAuth() + err := giteeAuth(userInRepo) + assert.NotNil(s.T(), err) } func (s *SuiteGitee) TestGetToken() { // getToken fail - token, err := getToken("user", "wrong_pwd") + token, err := getToken(s.UserName, s.Password) assert.Equal(s.T(), "", token) assert.NotNil(s.T(), err.Error()) } @@ -54,6 +85,10 @@ func (s *SuiteGitee) TestVerifyUser() { err := verifyUser(userInRepo) assert.NotNil(s.T(), err) + + userInRepo.Operation = "upload" + err = verifyUser(userInRepo) + assert.NotNil(s.T(), err) } func TestGitee(t *testing.T) { From 500c00ab66e5e3cc796eaa3edde3e19dd87cc3ab Mon Sep 17 00:00:00 2001 From: Zherphy <1123678689@qq.com> Date: Sat, 30 Nov 2024 10:38:53 +0800 Subject: [PATCH 5/7] add: add test add test --- auth/gitee.go | 61 ++++++++++++++++++++++++++-------------------- auth/gitee_test.go | 3 +++ 2 files changed, 38 insertions(+), 26 deletions(-) diff --git a/auth/gitee.go b/auth/gitee.go index 53436e2..3f72206 100644 --- a/auth/gitee.go +++ b/auth/gitee.go @@ -26,6 +26,7 @@ var ( var contentType = "Content-Type" var verifyLog = "verifyUser" +var appendPathAccessToken = "?access_token=" type giteeUser struct { Permission string `json:"permission"` @@ -106,9 +107,9 @@ func CheckRepoOwner(userInRepo UserInRepo) error { userInRepo.Repo, ) if userInRepo.Token != "" { - path += fmt.Sprintf("?access_token=%s", userInRepo.Token) + path += fmt.Sprintf(appendPathAccessToken + userInRepo.Token) } else { - path += fmt.Sprintf("?access_token=%s", defaultToken) + path += fmt.Sprintf(appendPathAccessToken + defaultToken) } headers := http.Header{contentType: []string{"application/json;charset=UTF-8"}} repo := new(Repo) @@ -166,44 +167,52 @@ func verifyUser(userInRepo UserInRepo) error { userInRepo.Username, ) if userInRepo.Token != "" { - path += fmt.Sprintf("?access_token=%s", userInRepo.Token) + path += fmt.Sprintf(appendPathAccessToken + userInRepo.Token) } else { - path += fmt.Sprintf("?access_token=%s", defaultToken) + path += fmt.Sprintf(appendPathAccessToken + defaultToken) } headers := http.Header{contentType: []string{"application/json;charset=UTF-8"}} giteeUser := new(giteeUser) err := getParsedResponse("GET", path, headers, nil, &giteeUser) if err != nil { msg := err.Error() + ": verify user permission failed" - logrus.Error(fmt.Sprintf("%s | %s", verifyLog, msg)) + logrus.Error(fmt.Sprintf(verifyLog + " | " + msg)) return errors.New(msg) } if userInRepo.Operation == "upload" { - for _, v := range uploadPermissions { - if giteeUser.Permission == v { - return nil - } - } - msg := fmt.Sprintf("forbidden: user %s has no permission to upload to %s/%s", - userInRepo.Username, userInRepo.Owner, userInRepo.Repo) - remindMsg := " \n如果您正在向fork仓库上传大文件,请确认您已使用如下命令修改了本地仓库的配置:" + - "\n`git config --local lfs.url https://artifacts.openeuler.openatom.cn/{owner}/{repo}`" + - ",\n其中{owner}/{repo}请改为您fork之后的仓库的名称" - logrus.Error(fmt.Sprintf("%s | %s", verifyLog, msg)) - return errors.New(msg + remindMsg) + return verifyUserUpload(giteeUser, userInRepo) } else if userInRepo.Operation == "download" { - for _, v := range downloadPermissions { - if giteeUser.Permission == v { - return nil - } - } - msg := fmt.Sprintf("forbidden: user %s has no permission to download", userInRepo.Username) - logrus.Error(fmt.Sprintf("%s | %s", verifyLog, msg)) - return errors.New(msg) + return verifyUserDownload(giteeUser, userInRepo) } else { msg := "system_error: unknow operation" - logrus.Error(fmt.Sprintf("%s | %s", verifyLog, msg)) + logrus.Error(fmt.Sprintf(verifyLog + " | " + msg)) return errors.New(msg) } } + +func verifyUserUpload(giteeUser *giteeUser, userInRepo UserInRepo) error { + for _, v := range uploadPermissions { + if giteeUser.Permission == v { + return nil + } + } + msg := fmt.Sprintf("forbidden: user %s has no permission to upload to %s/%s", + userInRepo.Username, userInRepo.Owner, userInRepo.Repo) + remindMsg := " \n如果您正在向fork仓库上传大文件,请确认您已使用如下命令修改了本地仓库的配置:" + + "\n`git config --local lfs.url https://artifacts.openeuler.openatom.cn/{owner}/{repo}`" + + ",\n其中{owner}/{repo}请改为您fork之后的仓库的名称" + logrus.Error(fmt.Sprintf(verifyLog + " | " + msg)) + return errors.New(msg + remindMsg) +} + +func verifyUserDownload(giteeUser *giteeUser, userInRepo UserInRepo) error { + for _, v := range downloadPermissions { + if giteeUser.Permission == v { + return nil + } + } + msg := fmt.Sprintf("forbidden: user %s has no permission to download", userInRepo.Username) + logrus.Error(fmt.Sprintf(verifyLog + " | " + msg)) + return errors.New(msg) +} diff --git a/auth/gitee_test.go b/auth/gitee_test.go index bb645e5..b60a84a 100644 --- a/auth/gitee_test.go +++ b/auth/gitee_test.go @@ -63,6 +63,7 @@ func (s *SuiteGitee) TestCheckRepoOwner() { userInRepo := UserInRepo{ Repo: s.Repo, Owner: s.Owner, + Token: s.cfg.DefaultToken, } err := CheckRepoOwner(userInRepo) assert.NotNil(s.T(), err) @@ -80,7 +81,9 @@ func (s *SuiteGitee) TestVerifyUser() { userInRepo := UserInRepo{ Repo: s.Repo, Owner: s.Owner, + Username: s.UserName, Operation: "download", + Token: s.cfg.DefaultToken, } err := verifyUser(userInRepo) From 2f6e7ca6761cbfb4a0dbf3a6629eb2236e695d02 Mon Sep 17 00:00:00 2001 From: Zherphy <1123678689@qq.com> Date: Sat, 30 Nov 2024 10:58:34 +0800 Subject: [PATCH 6/7] edit: fmt gitee.go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改gitee.go文件,规范代码 --- auth/gitee.go | 24 ++++++++++++++---------- auth/gitee_test.go | 1 + 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/auth/gitee.go b/auth/gitee.go index 3f72206..fae13e4 100644 --- a/auth/gitee.go +++ b/auth/gitee.go @@ -28,6 +28,8 @@ var contentType = "Content-Type" var verifyLog = "verifyUser" var appendPathAccessToken = "?access_token=" +const formatLogString = "%s | %s" + type giteeUser struct { Permission string `json:"permission"` } @@ -102,14 +104,15 @@ func GiteeAuth() func(UserInRepo) error { // CheckRepoOwner checks whether the owner of a repo is allowed to use lfs server func CheckRepoOwner(userInRepo UserInRepo) error { path := fmt.Sprintf( - "https://gitee.com/api/v5/repos/%s/%s", + "https://gitee.com/api/v5/repos/%s/%s%s", userInRepo.Owner, userInRepo.Repo, + appendPathAccessToken, ) if userInRepo.Token != "" { - path += fmt.Sprintf(appendPathAccessToken + userInRepo.Token) + path += userInRepo.Token } else { - path += fmt.Sprintf(appendPathAccessToken + defaultToken) + path += defaultToken } headers := http.Header{contentType: []string{"application/json;charset=UTF-8"}} repo := new(Repo) @@ -161,22 +164,23 @@ func getToken(username, password string) (string, error) { // verifyUser verifies user permission in repo by access_token and operation func verifyUser(userInRepo UserInRepo) error { path := fmt.Sprintf( - "https://gitee.com/api/v5/repos/%s/%s/collaborators/%s/permission", + "https://gitee.com/api/v5/repos/%s/%s/collaborators/%s/permission%s", userInRepo.Owner, userInRepo.Repo, userInRepo.Username, + appendPathAccessToken, ) if userInRepo.Token != "" { - path += fmt.Sprintf(appendPathAccessToken + userInRepo.Token) + path += userInRepo.Token } else { - path += fmt.Sprintf(appendPathAccessToken + defaultToken) + path += defaultToken } headers := http.Header{contentType: []string{"application/json;charset=UTF-8"}} giteeUser := new(giteeUser) err := getParsedResponse("GET", path, headers, nil, &giteeUser) if err != nil { msg := err.Error() + ": verify user permission failed" - logrus.Error(fmt.Sprintf(verifyLog + " | " + msg)) + logrus.Error(fmt.Sprintf(formatLogString, verifyLog, msg)) return errors.New(msg) } @@ -186,7 +190,7 @@ func verifyUser(userInRepo UserInRepo) error { return verifyUserDownload(giteeUser, userInRepo) } else { msg := "system_error: unknow operation" - logrus.Error(fmt.Sprintf(verifyLog + " | " + msg)) + logrus.Error(fmt.Sprintf(formatLogString, verifyLog, msg)) return errors.New(msg) } } @@ -202,7 +206,7 @@ func verifyUserUpload(giteeUser *giteeUser, userInRepo UserInRepo) error { remindMsg := " \n如果您正在向fork仓库上传大文件,请确认您已使用如下命令修改了本地仓库的配置:" + "\n`git config --local lfs.url https://artifacts.openeuler.openatom.cn/{owner}/{repo}`" + ",\n其中{owner}/{repo}请改为您fork之后的仓库的名称" - logrus.Error(fmt.Sprintf(verifyLog + " | " + msg)) + logrus.Error(fmt.Sprintf(formatLogString, verifyLog, msg)) return errors.New(msg + remindMsg) } @@ -213,6 +217,6 @@ func verifyUserDownload(giteeUser *giteeUser, userInRepo UserInRepo) error { } } msg := fmt.Sprintf("forbidden: user %s has no permission to download", userInRepo.Username) - logrus.Error(fmt.Sprintf(verifyLog + " | " + msg)) + logrus.Error(fmt.Sprintf(formatLogString, verifyLog, msg)) return errors.New(msg) } diff --git a/auth/gitee_test.go b/auth/gitee_test.go index b60a84a..bc5c6fb 100644 --- a/auth/gitee_test.go +++ b/auth/gitee_test.go @@ -72,6 +72,7 @@ func (s *SuiteGitee) TestCheckRepoOwner() { userInRepo = UserInRepo{ Repo: "repo", Owner: "owner", + Token: s.cfg.DefaultToken, } err = CheckRepoOwner(userInRepo) assert.NotNil(s.T(), err) From f31cbadb4490a194ebebecb6383ac5dd28411ef7 Mon Sep 17 00:00:00 2001 From: Zherphy <1123678689@qq.com> Date: Sat, 30 Nov 2024 14:51:09 +0800 Subject: [PATCH 7/7] edit: edit gitee.go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改gitee.go文件,声明字符串常量时使用const --- auth/gitee.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/auth/gitee.go b/auth/gitee.go index fae13e4..003344b 100644 --- a/auth/gitee.go +++ b/auth/gitee.go @@ -24,10 +24,9 @@ var ( downloadPermissions = []string{"admin", "developer", "read"} ) -var contentType = "Content-Type" -var verifyLog = "verifyUser" -var appendPathAccessToken = "?access_token=" - +const contentType = "Content-Type" +const verifyLog = "verifyUser" +const appendPathAccessToken = "?access_token=" const formatLogString = "%s | %s" type giteeUser struct { @@ -204,7 +203,7 @@ func verifyUserUpload(giteeUser *giteeUser, userInRepo UserInRepo) error { msg := fmt.Sprintf("forbidden: user %s has no permission to upload to %s/%s", userInRepo.Username, userInRepo.Owner, userInRepo.Repo) remindMsg := " \n如果您正在向fork仓库上传大文件,请确认您已使用如下命令修改了本地仓库的配置:" + - "\n`git config --local lfs.url https://artifacts.openeuler.openatom.cn/{owner}/{repo}`" + + "\n`git config --local lfs.url https://artlfs.openeuler.openatom.cn/{owner}/{repo}`" + ",\n其中{owner}/{repo}请改为您fork之后的仓库的名称" logrus.Error(fmt.Sprintf(formatLogString, verifyLog, msg)) return errors.New(msg + remindMsg)