From d9c2ffc08adad1a335b73cd347adffe737ebb8bc Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Tue, 23 Apr 2024 13:02:02 +0800 Subject: [PATCH] * Adjust gitlab project path get logic. --- module/gitlab/model.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/module/gitlab/model.php b/module/gitlab/model.php index 9ce1d89118..9f3abe8f17 100644 --- a/module/gitlab/model.php +++ b/module/gitlab/model.php @@ -2332,18 +2332,18 @@ class gitlabModel extends model * @param int $projectID * @param int $repoID * @access public - * @return bool + * @return string */ - public function updateCodePath(int $gitlabID, int $projectID, int $repoID): bool + public function updateCodePath(int $gitlabID, int $projectID, int $repoID): string { $project = $this->apiGetSingleProject($gitlabID, $projectID); if(is_object($project) and !empty($project->web_url)) { $this->dao->update(TABLE_REPO)->set('path')->eq($project->web_url)->where('id')->eq($repoID)->exec(); - return true; + return $project->web_url; } - return false; + return ''; } /** @@ -2417,6 +2417,7 @@ class gitlabModel extends model if(!$gitlab) return array(); /* Compatible with HTTP and HTTPS domain. */ + if(strpos($repo->codePath, '/api/v4/projects')) $repo->codePath = $this->updateCodePath((int)$repo->serviceHost, (int)$repo->serviceProject, $repo->id); $repo->client = str_replace('https://', 'http://', $repo->client); $repo->codePath = str_replace('https://', 'http://', $repo->codePath);