From 1844a6f728627af5145971ccea6589b5c3c496b0 Mon Sep 17 00:00:00 2001 From: jungejason Date: Sat, 26 Mar 2011 00:14:04 -0700 Subject: [PATCH] Get the correct uri_path for a diffusion request. Summary: there is a bug in getting the uri path. When the user clicks a line number twice, the new rev number and the line number is attached to the end of the original uri instead of substituting it. Test Plan: clicking line number multiple times, for both git and svn. Reviewers: epriestley CC: Differential Revision: 84 --- .../controller/file/DiffusionBrowseFileController.php | 2 +- src/applications/diffusion/request/base/DiffusionRequest.php | 4 ++++ .../diffusion/request/git/DiffusionGitRequest.php | 5 +++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/applications/diffusion/controller/file/DiffusionBrowseFileController.php b/src/applications/diffusion/controller/file/DiffusionBrowseFileController.php index 39d8e363b1..6b2632a658 100644 --- a/src/applications/diffusion/controller/file/DiffusionBrowseFileController.php +++ b/src/applications/diffusion/controller/file/DiffusionBrowseFileController.php @@ -88,7 +88,7 @@ class DiffusionBrowseFileController extends DiffusionController { $file_content->getCorpus()); $data = explode("\n", rtrim($data)); - $uri_path = $request->getPath(); + $uri_path = $drequest->getUriPath(); $uri_rev = $drequest->getCommit(); $color = null; diff --git a/src/applications/diffusion/request/base/DiffusionRequest.php b/src/applications/diffusion/request/base/DiffusionRequest.php index eeadc6e739..c4b89144be 100644 --- a/src/applications/diffusion/request/base/DiffusionRequest.php +++ b/src/applications/diffusion/request/base/DiffusionRequest.php @@ -92,6 +92,10 @@ class DiffusionRequest { return $this->path; } + public function getUriPath() { + return '/diffusion/'.$this->getCallsign().'/browse/'.$this->path; + } + public function getLine() { return $this->line; } diff --git a/src/applications/diffusion/request/git/DiffusionGitRequest.php b/src/applications/diffusion/request/git/DiffusionGitRequest.php index b88e6cf2e3..56351b65eb 100644 --- a/src/applications/diffusion/request/git/DiffusionGitRequest.php +++ b/src/applications/diffusion/request/git/DiffusionGitRequest.php @@ -94,6 +94,11 @@ class DiffusionGitRequest extends DiffusionRequest { throw new Exception("Unable to determine branch!"); } + public function getUriPath() { + return '/diffusion/'.$this->getCallsign().'/browse/'. + $this->branch.'/'.$this->path; + } + public function getCommit() { if ($this->commit) { return $this->commit;