20after4 has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/259887

Change subject: Filter out refs/heads when redirecting gerrit urls
......................................................................

Filter out refs/heads when redirecting gerrit urls

This just strips out the refs/heads prefix and also
urlencodes the branch name since slashes in the name
seem to confuse diffusion.

Change-Id: Ie464c5706c3d2ba8452e9bd234cf1f5b46f6cf64
---
M GerritProjectController.php
1 file changed, 4 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/phabricator/extensions 
refs/changes/87/259887/1

diff --git a/GerritProjectController.php b/GerritProjectController.php
index 7d2d43e..8b87873 100644
--- a/GerritProjectController.php
+++ b/GerritProjectController.php
@@ -1321,6 +1321,10 @@
                 return new Aphront404Response();
             }
             $branch = $data['branch'];
+            $branch = str_replace('refs/heads','', $branch);
+            $branch = trim($branch, '/');
+            $branch = urlencode($branch);
+
             return id(new AphrontRedirectResponse())
                 ->setURI("/diffusion/$CALLSIGN/browse/$branch/");
         }

-- 
To view, visit https://gerrit.wikimedia.org/r/259887
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie464c5706c3d2ba8452e9bd234cf1f5b46f6cf64
Gerrit-PatchSet: 1
Gerrit-Project: phabricator/extensions
Gerrit-Branch: master
Gerrit-Owner: 20after4 <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to