From: Brion Vibber Date: Sun, 30 Jan 2005 04:11:22 +0000 (+0000) Subject: * (bug 1228) Fix double-escaping on & sequences in [enclosed] URLs X-Git-Tag: 1.5.0alpha1~820 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=07650eba1d0125a615d4d0dd69f171fd416f1d7e;p=lhc%2Fweb%2Fwiklou.git * (bug 1228) Fix double-escaping on & sequences in [enclosed] URLs --- diff --git a/includes/Parser.php b/includes/Parser.php index 1f1701e197..3ed672bbdf 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -1015,6 +1015,11 @@ class Parser } } + # Replace & from obsolete syntax with &. + # All HTML entities will be escaped by makeExternalLink() + # or maybeMakeImageLink() + $url = str_replace( '&', '&', $url ); + # Process the trail (i.e. everything after this link up until start of the next link), # replacing any non-bracketed links $trail = $this->replaceFreeExternalLinks( $trail ); diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt index 79a6afddf5..47656ef6ba 100644 --- a/maintenance/parserTests.txt +++ b/maintenance/parserTests.txt @@ -480,6 +480,33 @@ Old & use: http://x&y

!! end +!! test +External links: encoded ampersand +!! input +Old & use: http://x&y +!! result +

Old & use: http://x&y +

+!! end + +!! test +External links: [raw ampersand] +!! input +Old & use: [http://x&y] +!! result +

Old & use: [1] +

+!! end + +!! test +External links: [encoded ampersand] +!! input +Old & use: [http://x&y] +!! result +

Old & use: [1] +

+!! end + !! test External links: www.jpeg.org (bug 554) !! input