about summary refs log tree commit homepage
path: root/lib/PublicInbox/Linkify.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-08-18 02:02:50 +0000
committerEric Wong <e@80x24.org>2016-08-18 02:03:41 +0000
commitdfe55f5ee5bd6e3a12d933a6570eb94f294d1c54 (patch)
tree9037a2566e26d844e843faa8ccccb8e0d6438bfd /lib/PublicInbox/Linkify.pm
parent1b28cc7f00a866cb2b60a6569002db1f605019d5 (diff)
downloadpublic-inbox-dfe55f5ee5bd6e3a12d933a6570eb94f294d1c54.tar.gz
We're not to-the-letter about percent-encoding, but
we should allow all the characters.  This is mainly
so we can effectively use the link to some Wikipedia
pages with parentheses in them:

	https://en.wikipedia.org/wiki/Atom_(standard)
	https://en.wikipedia.org/wiki/Git_(software)
Diffstat (limited to 'lib/PublicInbox/Linkify.pm')
-rw-r--r--lib/PublicInbox/Linkify.pm5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/PublicInbox/Linkify.pm b/lib/PublicInbox/Linkify.pm
index d4df689e..ea7fd71f 100644
--- a/lib/PublicInbox/Linkify.pm
+++ b/lib/PublicInbox/Linkify.pm
@@ -17,7 +17,10 @@ use Digest::SHA qw/sha1_hex/;
 my $SALT = rand;
 my $LINK_RE = qr{\b((?:ftps?|https?|nntps?|gopher)://
                  [\@:\w\.-]+/
-                 ?[!,:~\$\@\w\+\&\?\.\%\;/#=-]*)}x;
+                 (?:[a-z0-9\-\._~!\$\&\';\(\)\*\+,;=:@/%]*)
+                 (?:\?[a-z0-9\-\._~!\$\&\';\(\)\*\+,;=:@/%]+)?
+                 (?:\#[a-z0-9\-\._~!\$\&\';\(\)\*\+,;=:@/%\?]+)?
+                 )}xi;
 
 sub new { bless {}, shift }