From ffe47618295397bca631e1ceabeb598d743d53b4 Mon Sep 17 00:00:00 2001 From: dingguodong Date: Tue, 23 Apr 2024 16:35:56 +0800 Subject: [PATCH] * Fix the issue if the host type is Gitea/Gogs. --- module/mr/zen.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/module/mr/zen.php b/module/mr/zen.php index f86eb7bcf8..b2b438f722 100644 --- a/module/mr/zen.php +++ b/module/mr/zen.php @@ -276,13 +276,13 @@ class mrZen extends mr * 获取代码分支的访问地址。 * Get repo branch url. * - * @param object $host - * @param int $projectID - * @param string $branch + * @param object $host + * @param int|string $projectID $projectID is an int in gitlab or gitfox and a string in gitea or gogs. + * @param string $branch * @access protected * @return string */ - protected function getBranchUrl(object $host, int $projectID, string $branch): string + protected function getBranchUrl(object $host, int|string $projectID, string $branch): string { if($host->type == 'gitfox') { @@ -292,7 +292,7 @@ class mrZen extends mr return rtrim($host->url, '/') . "/{$project->path}/files/{$branch}"; } - $branch = $this->{$host->type}->apiGetSingleBranch($host->id, $projectID, $branch); + $branch = $this->loadModel($host->type)->apiGetSingleBranch($host->id, $projectID, $branch); return $branch ? zget($branch, 'web_url', '') : ''; } }