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. --- t/linkify.t | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 't/linkify.t') diff --git a/t/linkify.t b/t/linkify.t index a55ed22a..f0b3a6d0 100644 --- a/t/linkify.t +++ b/t/linkify.t @@ -14,6 +14,15 @@ use PublicInbox::Linkify; is($s, qq($u.), 'trailing period not in URL'); } +{ + my $l = PublicInbox::Linkify->new; + my $u = 'http://i-forgot-trailing-slash.example.com'; + my $s = $u; + $s = $l->linkify_1($s); + $s = $l->linkify_2($s); + is($s, qq($u), 'missing trailing slash OK'); +} + # handle URLs in parenthesized statements { my $l = PublicInbox::Linkify->new; -- cgit v1.2.3-24-ge0c7