From a6865a622bafba472ca2f0472b777bb4022544d7 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sat, 24 Dec 2005 10:07:26 +0000 Subject: [PATCH] * (bug 4377) "[" is not valid in URLs --- RELEASE-NOTES | 1 + includes/Parser.php | 2 +- maintenance/parserTests.txt | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 00109341c3..d12ef2674f 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -349,6 +349,7 @@ fully support the editing toolbar, but was found to be too confusing. * Fix autoconfirm check for old accounts * (bug 4368) Don't show useless empty preview on new section creation * Don't show useless empty preview on new page creation +* (bug 4377) "[" is not valid in URLs === Caveats === diff --git a/includes/Parser.php b/includes/Parser.php index 86d885f52c..5fa67cf4d8 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -46,7 +46,7 @@ define( 'STRIP_COMMENTS', 'HTMLCommentStrip' ); # Constants needed for external link processing define( 'HTTP_PROTOCOLS', 'http:\/\/|https:\/\/' ); # Everything except bracket, space, or control characters -define( 'EXT_LINK_URL_CLASS', '[^]<>"\\x00-\\x20\\x7F]' ); +define( 'EXT_LINK_URL_CLASS', '[^][<>"\\x00-\\x20\\x7F]' ); # Including space define( 'EXT_LINK_TEXT_CLASS', '[^\]\\x00-\\x1F\\x7F]' ); define( 'EXT_IMAGE_FNAME_CLASS', '[A-Za-z0-9_.,~%\\-+&;#*?!=()@\\x80-\\xFF]' ); diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt index bed461475b..792902ac3f 100644 --- a/maintenance/parserTests.txt +++ b/maintenance/parserTests.txt @@ -394,6 +394,24 @@ External links: dollar sign in URL (named)

!!end +!! test +External links: open square bracket forbidden in URL (bug 4377) +!! input +http://example.com/1[2345 +!! result +

http://example.com/1[2345 +

+!! end + +!! test +External links: open square bracket forbidden in URL (named) (bug 4377) +!! input +[http://example.com/1[2345] +!! result +

[2345 +

+!!end + !! test External image !! input -- 2.20.1