summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2011-01-14 08:33:46 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2011-01-14 08:33:46 +0000
commitda1a859349170aa42494e8588c37570e644f9c6d (patch)
treee47b41476a6174169fcfaf2a13b49994b04d1c4f /modules
parentab5809ac52241105e7241c95a42318c8d1afd84b (diff)
downloadbrdo-da1a859349170aa42494e8588c37570e644f9c6d.tar.gz
brdo-da1a859349170aa42494e8588c37570e644f9c6d.tar.bz2
#1015012 by sun: Fix URL filter so that it recognizes valid URLs with # in them, e.g. twitter.
Diffstat (limited to 'modules')
-rw-r--r--modules/filter/filter.module2
-rw-r--r--modules/filter/filter.test4
2 files changed, 4 insertions, 2 deletions
diff --git a/modules/filter/filter.module b/modules/filter/filter.module
index 0c0867a12..24c64bd55 100644
--- a/modules/filter/filter.module
+++ b/modules/filter/filter.module
@@ -1392,7 +1392,7 @@ function _filter_url($text, $filter) {
$domain = '(?:[A-Za-z0-9._+-]+\.)?[A-Za-z]{2,64}\b';
$ip = '(?:[0-9]{1,3}\.){3}[0-9]{1,3}';
$auth = '[a-zA-Z0-9:%_+*~#?&=.,/;-]+@';
- $trail = '[a-zA-Z0-9:%_+*~#&\[\]=/;?\.,-]*[a-zA-Z0-9:%_+*~#&\[\]=/;-]';
+ $trail = '[a-zA-Z0-9:%_+*~#&\[\]=/;?!\.,-]*[a-zA-Z0-9:%_+*~#&\[\]=/;-]';
// Prepare pattern for optional trailing punctuation.
// Even these characters could have a valid meaning for the URL, such usage is
diff --git a/modules/filter/filter.test b/modules/filter/filter.test
index b96c24042..e878477c1 100644
--- a/modules/filter/filter.test
+++ b/modules/filter/filter.test
@@ -1176,10 +1176,11 @@ person@example.com or mailto:person2@example.com
'<a href="mailto:person@example.com">person@example.com</a>' => TRUE,
'<a href="mailto:person2@example.com">mailto:person2@example.com</a>' => TRUE,
),
- // URI parts.
+ // URI parts and special characters.
'
http://trailingslash.com/ or www.trailingslash.com/
http://host.com/some/path?query=foo&bar[baz]=beer#fragment or www.host.com/some/path?query=foo&bar[baz]=beer#fragment
+http://twitter.com/#!/example/status/22376963142324226
ftp://user:pass@ftp.example.com/~home/dir1
sftp://user@nonstandardport:222/dir
ssh://192.168.0.100/srv/git/drupal.git
@@ -1188,6 +1189,7 @@ ssh://192.168.0.100/srv/git/drupal.git
'<a href="http://www.trailingslash.com/">www.trailingslash.com/</a>' => TRUE,
'<a href="http://host.com/some/path?query=foo&amp;bar[baz]=beer#fragment">http://host.com/some/path?query=foo&amp;bar[baz]=beer#fragment</a>' => TRUE,
'<a href="http://www.host.com/some/path?query=foo&amp;bar[baz]=beer#fragment">www.host.com/some/path?query=foo&amp;bar[baz]=beer#fragment</a>' => TRUE,
+ '<a href="http://twitter.com/#!/example/status/22376963142324226">http://twitter.com/#!/example/status/22376963142324226</a>' => TRUE,
'<a href="ftp://user:pass@ftp.example.com/~home/dir1">ftp://user:pass@ftp.example.com/~home/dir1</a>' => TRUE,
'<a href="sftp://user@nonstandardport:222/dir">sftp://user@nonstandardport:222/dir</a>' => TRUE,
'<a href="ssh://192.168.0.100/srv/git/drupal.git">ssh://192.168.0.100/srv/git/drupal.git</a>' => TRUE,