* Adjust scm check rule for file tree get.

This commit is contained in:
caoyanyi
2023-12-18 15:48:21 +08:00
parent 6de6f56697
commit cd50412c19
2 changed files with 10 additions and 2 deletions
+1 -1
View File
@@ -2002,7 +2002,7 @@ class repo extends control
$repo = $this->repo->getByID($repoID);
if($path) $path = helper::safe64Decode($path);
if($repo->SCM == 'gitlab') return print(json_encode($this->repo->getGitlabFilesByPath($repo, $path, $branch)));
if($repo->SCM == 'Gitlab') return print(json_encode($this->repo->getGitlabFilesByPath($repo, $path, $branch)));
return print(json_encode($this->repoZen->getViewTree($repo, $path, $branch)));
}
}
+9 -1
View File
@@ -2170,7 +2170,15 @@ class repoModel extends model
$service = $this->loadModel('pipeline')->getByID($repo->serviceHost);
if($repo->SCM == 'Gitlab')
{
if($getCodePath) $project = $this->loadModel('gitlab')->apiGetSingleProject($repo->serviceHost, $repo->serviceProject);
if($getCodePath)
{
$project = $this->loadModel('gitlab')->apiGetSingleProject((int)$repo->serviceHost, (int)$repo->serviceProject);
if(isset($project->web_url) && $repo->path != $project->web_url)
{
$repo->path = $project->web_url;
$this->dao->update(TABLE_REPO)->set('path')->eq($repo->path)->where('id')->eq($repo->id)->exec();
}
}
$repo->path = (!$repo->path && $service) ? sprintf($this->config->repo->{$service->type}->apiPath, $service->url, $repo->serviceProject) : $repo->path;
$repo->apiPath = sprintf($this->config->repo->{$service->type}->apiPath, $service->url, $repo->serviceProject);