From a8a8c65e63f428aa9f6bd5b351b6de202244e2dc Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Wed, 23 Feb 2022 17:12:48 +0800 Subject: [PATCH 1/2] * Modify code error. --- module/repo/control.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/module/repo/control.php b/module/repo/control.php index 09d8d15c21..617f66672c 100644 --- a/module/repo/control.php +++ b/module/repo/control.php @@ -837,6 +837,11 @@ class repo extends control { $fromRevision = str_replace('*', '-', $fromRevision); $toRevision = str_replace('*', '-', $toRevision); + if($isBranchOrTag) + { + $fromRevision = urldecode(helper::safe64Decode($fromRevision)); + $toRevision = urldecode(helper::safe64Decode($toRevision)); + } if($this->get->repoPath) $path = $this->get->repoPath; $entry = $this->repo->decodePath($path); @@ -905,7 +910,7 @@ class repo extends control $this->view->repoID = $repoID; $this->view->objectID = $objectID; $this->view->branch = $branch; - $this->view->browseLink = $this->repo->createLink('browse', "repoID=" . ($this->app->tab == 'devops' ? $repoID : '') . "&branchID=$branch&objectID=$objectID", '', false); + $this->view->browseLink = $this->repo->createLink('browse', "repoID=" . ($this->app->tab == 'devops' ? $repoID : '') . "&branchID=" . base64_encode($branch) . "&objectID=$objectID", '', false); $this->display(); } From 82b8f0afe1f03cdc800eb412953c440addadab2c Mon Sep 17 00:00:00 2001 From: zenggang Date: Wed, 23 Feb 2022 09:17:01 +0000 Subject: [PATCH 2/2] * Fix bug#19866 --- module/repo/control.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/module/repo/control.php b/module/repo/control.php index 09d8d15c21..412dbc8d2c 100644 --- a/module/repo/control.php +++ b/module/repo/control.php @@ -835,13 +835,16 @@ class repo extends control */ public function download($repoID, $path, $fromRevision = 'HEAD', $toRevision = '', $type = 'file', $isBranchOrTag = false) { - $fromRevision = str_replace('*', '-', $fromRevision); - $toRevision = str_replace('*', '-', $toRevision); - if($this->get->repoPath) $path = $this->get->repoPath; $entry = $this->repo->decodePath($path); $repo = $this->repo->getRepoByID($repoID); + if($isBranchOrTag) + { + $fromRevision = urldecode(helper::safe64Decode($fromRevision)); + $toRevision = urldecode(helper::safe64Decode($toRevision)); + } + $this->commonAction($repoID); $this->scm->setEngine($repo); $content = $type == 'file' ? $this->scm->cat($entry, $fromRevision) : $this->scm->diff($entry, $fromRevision, $toRevision, 'patch', $isBranchOrTag ? 'isBranchOrTag': '');