From 58700fb1830d1f854e688dfa47390d7f2eef9035 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 1 Feb 2019 05:27:52 +0000 Subject: linkify: support proto://hostname without trailing slash Sometimes users will write "http://example.com" without the trailing slash, which every browser and tool I've tested seems to understand. --- lib/PublicInbox/Linkify.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/PublicInbox') diff --git a/lib/PublicInbox/Linkify.pm b/lib/PublicInbox/Linkify.pm index 274f3820..aa472cdb 100644 --- a/lib/PublicInbox/Linkify.pm +++ b/lib/PublicInbox/Linkify.pm @@ -16,11 +16,12 @@ use Digest::SHA qw/sha1_hex/; my $SALT = rand; my $LINK_RE = qr{(\()?\b((?:ftps?|https?|nntps?|gopher):// - [\@:\w\.-]+/ + [\@:\w\.-]+(?:/ (?:[a-z0-9\-\._~!\$\&\';\(\)\*\+,;=:@/%]*) (?:\?[a-z0-9\-\._~!\$\&\';\(\)\*\+,;=:@/%]+)? (?:\#[a-z0-9\-\._~!\$\&\';\(\)\*\+,;=:@/%\?]+)? - )}xi; + )? + )}xi; sub new { bless {}, $_[0] } -- cgit v1.2.3-24-ge0c7