20after4 has submitted this change and it was merged.

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(-)

Approvals:
  Paladox: Looks good to me, but someone else must approve
  20after4: Looks good to me, approved
  jenkins-bot: Verified



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: merged
Gerrit-Change-Id: Ie464c5706c3d2ba8452e9bd234cf1f5b46f6cf64
Gerrit-PatchSet: 1
Gerrit-Project: phabricator/extensions
Gerrit-Branch: master
Gerrit-Owner: 20after4 <[email protected]>
Gerrit-Reviewer: 20after4 <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: Paladox <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to