r45780 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45779‎ | r45780 | r45781 >
Date:18:36, 15 January 2009
Author:aaron
Status:resolved (Comments)
Tags:
Comment:
Redid r45389 "Disallow broken Talk:File:x type titles (bug 5280)"
Modified paths:
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Title.php
@@ -2064,14 +2064,20 @@
20652065
20662066 # Namespace or interwiki prefix
20672067 $firstPass = true;
 2068+ $prefixRegexp = "/^(.+?)_*:_*(.*)$/S";
20682069 do {
20692070 $m = array();
2070 - if ( preg_match( "/^(.+?)_*:_*(.*)$/S", $dbkey, $m ) ) {
 2071+ if ( preg_match( $prefixRegexp, $dbkey, $m ) ) {
20712072 $p = $m[1];
2072 - if ( $ns = $wgContLang->getNsIndex( $p )) {
 2073+ if ( $ns = $wgContLang->getNsIndex( $p ) ) {
20732074 # Ordinary namespace
20742075 $dbkey = $m[2];
20752076 $this->mNamespace = $ns;
 2077+ # For Talk:X pages, check if X has a "namespace" prefix
 2078+ if( $ns == NS_TALK && preg_match( $prefixRegexp, $dbkey, $x ) ) {
 2079+ if( $wgContLang->getNsIndex( $x[1] ) )
 2080+ return false; # Disallow Talk:File:x type titles...
 2081+ }
20762082 } elseif( Interwiki::isValidInterwiki( $p ) ) {
20772083 if( !$firstPass ) {
20782084 # Can't make a local interwiki link to an interwiki link.

Follow-up revisions

RevisionCommit summaryAuthorDate
r45939Follow up to r45780: catch Talk:interwiki:x linksaaron22:55, 20 January 2009
r111085(bug 28936, bug 5280) Broken or invalid titles can't be removed from watchlis...maxsem20:39, 9 February 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r45389Disallow broken Talk:File:x type titles (bug 5280)aaron09:39, 4 January 2009
r45479Revert r45389 "Disallow broken Talk:File:x type titles (bug 5280)"...brion02:55, 7 January 2009

Comments

#Comment by Brion VIBBER (talk | contribs)   22:14, 20 January 2009

This is still allowing pages like 'Talk:Wikipedia:Foo', for which 'Wikipedia:Foo' is an interwiki link.

#Comment by Aaron Schulz (talk | contribs)   22:31, 20 January 2009

Shouldn't that be a TODO then instead of fixme?

#Comment by Aaron Schulz (talk | contribs)   22:55, 20 January 2009

See r45939

Status & tagging log