From afee47ac5e2cdc968d92dc395d0c949ffb159416 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Tue, 12 Apr 2005 06:07:23 +0000 Subject: [PATCH] * (bug 1300) Links like [[Image:Foo.png|thumb|[http://example.com]]] now work. --- includes/Parser.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/includes/Parser.php b/includes/Parser.php index d5ddd25551..0cbcad6526 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -1151,6 +1151,14 @@ class Parser if ( preg_match( $e1, $line, $m ) ) { # page with normal text or alt $text = $m[2]; + # If we get a ] at the beginning of $m[3] that means we have a link that's something like: + # [[Image:Foo.jpg|[http://example.com desc]]] <- having three ] in a row fucks up, + # the real problem is with the $e1 regex + # See bug 1300. + if (preg_match( "/^\](.*)/", $m[3], $n ) ) { + $text .= ']'; # so that replaceExternalLinks($text) works later + $m[3] = $n[1]; + } # fix up urlencoded title texts if(preg_match('/%/', $m[1] )) $m[1] = urldecode($m[1]); $trail = $m[3]; -- 2.20.1