Remove any additional trailing slashes when subpaging is enabled
authorAntoine Musso <hashar@users.mediawiki.org>
Sun, 21 Jan 2007 03:47:38 +0000 (03:47 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Sun, 21 Jan 2007 03:47:38 +0000 (03:47 +0000)
includes/Parser.php

index 17ee937..587c637 100644 (file)
@@ -1922,9 +1922,9 @@ class Parser
                        # Look at the first character
                        if( $target != '' && $target{0} == '/' ) {
                                # / at end means we don't want the slash to be shown
-                               if( substr( $target, -1, 1 ) == '/' ) {
-                                       $target = substr( $target, 1, -1 );
-                                       $noslash = $target;
+                               $trailingSlashes = preg_match_all( '%(/+)$%', $target, $m );
+                               if( $trailingSlashes ) {
+                                       $noslash = $target = substr( $target, 1, -strlen($m[0][0]) );
                                } else {
                                        $noslash = substr( $target, 1 );
                                }