Catrope has uploaded a new change for review.

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

Change subject: Anchor the regex for ./ stripping
......................................................................

Anchor the regex for ./ stripping

So it doesn't strip ./ or ../ out of the middle of page names.
Apparently it's common to have user names on hewiki end with dots,
so their user subpages end up being of the form [[User:Foo./Bar]].
This unanchored regex corrupted links to those pages.

Bug: T110676
Change-Id: I0cb3e47afd2b3d0d9d953f6650f5858f9bdb58e9
(cherry picked from commit dc10381d1fe3506112bbabf374761291afe957d6)
---
M includes/Parsoid/Utils.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/74/234574/1

diff --git a/includes/Parsoid/Utils.php b/includes/Parsoid/Utils.php
index b4299c6..475a34a 100644
--- a/includes/Parsoid/Utils.php
+++ b/includes/Parsoid/Utils.php
@@ -303,7 +303,7 @@
                // currently parsoid always uses enough ../ or ./ to go
                // back to the root, a bit of a kludge but just assume we
                // can strip and will end up with a non-relative text.
-               $text = preg_replace( '|(\.\.?/)+|', '', $text );
+               $text = preg_replace( '|^(\.\.?/)+|', '', $text );
 
                if ( $text && ( $text[0] === '/' || $text[0] === '#' ) ) {
                        return Title::newFromText( $title->getDBkey() . $text, 
$title->getNamespace() );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0cb3e47afd2b3d0d9d953f6650f5858f9bdb58e9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: wmf/1.26wmf20
Gerrit-Owner: Catrope <roan.katt...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to