From: Ævar Arnfjörð Bjarmason Date: Tue, 12 Apr 2005 06:07:23 +0000 (+0000) Subject: * (bug 1300) Links like [[Image:Foo.png|thumb|[http://example.com]]] now work. X-Git-Tag: 1.5.0alpha1~288 X-Git-Url: https://git.cyclocoop.org//%22%7B%7Blocalurle:Project:Pol%C3%ADtica_de_imagens%7D%7D/%22?a=commitdiff_plain;h=afee47ac5e2cdc968d92dc395d0c949ffb159416;p=lhc%2Fweb%2Fwiklou.git * (bug 1300) Links like [[Image:Foo.png|thumb|[example.com]]] now work. --- 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];