From 2aaf98ef9d156d7cd65dfab8c004f1118a0e1779 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sun, 26 Feb 2006 02:25:56 +0000 Subject: [PATCH] * (bug 5081) Remove bogus fix for invalid characters in links which simply broke use of legitimate multiple whitespace characters in bracketed link. Broken by Magnus's revision 1.593 of Parser.php, February 22 2006 --- RELEASE-NOTES | 2 ++ includes/Parser.php | 11 ++--------- maintenance/parserTests.txt | 9 +++++++++ 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 2fd0757575..8ae805224c 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -657,6 +657,8 @@ fully support the editing toolbar, but was found to be too confusing. * Make Live Preview an user preference, still controllable by the global variable * Rename the stub LanguageAls / LanguageGem_alsation to LanguageGsw to follow updated language code assignments +* (bug 5081) Remove bogus fix for invalid characters in links which simply + broke use of legitimate multiple whitespace characters in bracketed link. === Caveats === diff --git a/includes/Parser.php b/includes/Parser.php index c4fed1d1b7..47644b8a89 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -51,7 +51,7 @@ define( 'EXT_LINK_URL_CLASS', '[^][<>"\\x00-\\x20\\x7F]' ); define( 'EXT_LINK_TEXT_CLASS', '[^\]\\x00-\\x1F\\x7F]' ); define( 'EXT_IMAGE_FNAME_CLASS', '[A-Za-z0-9_.,~%\\-+&;#*?!=()@\\x80-\\xFF]' ); define( 'EXT_IMAGE_EXTENSIONS', 'gif|png|jpg|jpeg' ); -define( 'EXT_LINK_BRACKETED', '/\[(\b(' . wfUrlProtocols() . ')'.EXT_LINK_URL_CLASS.'+)( *)('.EXT_LINK_TEXT_CLASS.'*?)\]/S' ); +define( 'EXT_LINK_BRACKETED', '/\[(\b(' . wfUrlProtocols() . ')'.EXT_LINK_URL_CLASS.'+) *('.EXT_LINK_TEXT_CLASS.'*?)\]/S' ); define( 'EXT_IMAGE_REGEX', '/^('.HTTP_PROTOCOLS.')'. # Protocol '('.EXT_LINK_URL_CLASS.'+)\\/'. # Hostname and path @@ -1085,7 +1085,6 @@ class Parser while ( $imakeExternalLink( $url, $text, false, $linktype ) . $dtrail . $trail; - } else { - # Fix for [url text] (notice the two blanks) - $s .= '[' . $sk->makeExternalLink( $url, $url, false, "free" ) . $spaces . $text . ']' . $dtrail . $trail; - } + $s .= $sk->makeExternalLink( $url, $text, false, $linktype ) . $dtrail . $trail; # Register link in the output object $this->mOutput->addExternalLink( $url ); diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt index 30e9cdfdd8..5e90909cac 100644 --- a/maintenance/parserTests.txt +++ b/maintenance/parserTests.txt @@ -676,6 +676,15 @@ External links: invalid character

!! end +!! test +External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081) +!! input +[http://www.example.com test] +!! result +

test +

+!! end + !! test BUG 787: Links with one slash after the url protocol are invalid !! input -- 2.20.1