Index: trunk/phase3/includes/parser/CoreParserFunctions.php |
— | — | @@ -126,8 +126,12 @@ |
127 | 127 | # attempt, url-decode and try for a second. |
128 | 128 | if( is_null( $title ) ) |
129 | 129 | $title = Title::newFromUrl( urldecode( $s ) ); |
130 | | - if ( !is_null( $title ) ) { |
131 | | - if ( !is_null( $arg ) ) { |
| 130 | + if( !is_null( $title ) ) { |
| 131 | + # Convert NS_MEDIA -> NS_FILE |
| 132 | + if( $title->getNamespace() == NS_MEDIA ) { |
| 133 | + $title = Title::makeTitle( NS_FILE, $title->getDBKey() ); |
| 134 | + } |
| 135 | + if( !is_null( $arg ) ) { |
132 | 136 | $text = $title->$func( $arg ); |
133 | 137 | } else { |
134 | 138 | $text = $title->$func(); |