r79639 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79638‎ | r79639 | r79640 >
Date:06:16, 5 January 2011
Author:dantman
Status:ok (Comments)
Tags:
Comment:
Allow filenames to be specified in a <gallery> with the File:, Image: or media: omitted by defaulting to NS_FILE.
Modified paths:
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/Parser.php
@@ -4526,7 +4526,7 @@
45274527 if ( strpos( $matches[0], '%' ) !== false ) {
45284528 $matches[1] = rawurldecode( $matches[1] );
45294529 }
4530 - $tp = Title::newFromText( $matches[1] );
 4530+ $tp = Title::newFromText( $matches[1], NS_FILE );
45314531 $nt =& $tp;
45324532 if ( is_null( $nt ) ) {
45334533 # Bogus title. Ignore these so we don't bomb out later.

Follow-up revisions

RevisionCommit summaryAuthorDate
r84895Followup r79639, add a new parser test for gallery items not using a namespac...dantman03:57, 28 March 2011

Comments

#Comment by Nikerabbit (talk | contribs)   07:36, 5 January 2011

The assignment below your change is useless, isn't it?

#Comment by Dantman (talk | contribs)   07:41, 5 January 2011

Looks like it I suppose, the code using $nt could use $tp instead, or $nt could be set directly... though it's a little beyond the scope of that simple commit.

#Comment by MaxSem (talk | contribs)   14:47, 5 January 2011

Needs parser tests.

#Comment by Dantman (talk | contribs)   03:59, 28 March 2011

Done. Added a new parser test for namespace-less gallery items.

#Comment by Aaron Schulz (talk | contribs)   07:20, 28 March 2011

The previous behavior was odd (for regular text, no namespace). I *think* this is OK though.

#Comment by Dantman (talk | contribs)   05:33, 29 March 2011

At the very least, we didn't have any parser test guaranteeing the old behavior.

Status & tagging log