20after4 has submitted this change and it was merged.

Change subject: Don't make urls ending with double slash.
......................................................................


Don't make urls ending with double slash.

Diffusion is very picky about it's urls.

Change-Id: If9de7563804df06582e917bdfaff8b32400baf39
---
M GerritProjectController.php
1 file changed, 7 insertions(+), 3 deletions(-)

Approvals:
  20after4: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/GerritProjectController.php b/GerritProjectController.php
index bf6d5c9..2dc27f3 100644
--- a/GerritProjectController.php
+++ b/GerritProjectController.php
@@ -1327,9 +1327,13 @@
             $branch = str_replace('HEAD', '');
             // double encode any forward slashes in ref.
             $branch = str_replace('/', '%252F', $branch);
-
-            return id(new AphrontRedirectResponse())
-                ->setURI("/diffusion/$CALLSIGN/browse/$branch/");
+            if (strlen($branch)==0){
+                  return id(new AphrontRedirectResponse())
+                        ->setURI("/diffusion/$CALLSIGN/browse/");
+            } else {
+                  return id(new AphrontRedirectResponse())
+                        ->setURI("/diffusion/$CALLSIGN/browse/$branch/");
+            }
         }
         if ($data['action'] == 'browse') {
             if (!isset($data['branch']) || !isset($data['file'])) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If9de7563804df06582e917bdfaff8b32400baf39
Gerrit-PatchSet: 1
Gerrit-Project: phabricator/extensions
Gerrit-Branch: master
Gerrit-Owner: 20after4 <[email protected]>
Gerrit-Reviewer: 20after4 <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to