From d1dbf32d5b747deb4610f98b0befdb8b6a32243a Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 12 Jun 2021 00:10:45 +0000 Subject: net_reader: canonicalize URL args on add_url This fixes cases when users specify an IMAP or NNTP URL with standard port numbers explicitly. In other words, this allows users to use "lei ls-mail-source nntps://public-inbox.org:563/" and "lei ls-mail-source imaps://public-inbox.org:993/" without hitting "BUG:" errors. --- lib/PublicInbox/NetReader.pm | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/PublicInbox/NetReader.pm') diff --git a/lib/PublicInbox/NetReader.pm b/lib/PublicInbox/NetReader.pm index bcc6cbf0..30784199 100644 --- a/lib/PublicInbox/NetReader.pm +++ b/lib/PublicInbox/NetReader.pm @@ -371,8 +371,10 @@ sub add_url { my ($self, $arg, $ls_ok) = @_; my $uri; if ($uri = imap_uri($arg, $ls_ok)) { + $_[1] = $$uri; # canonicalized push @{$self->{imap_order}}, $uri; } elsif ($uri = nntp_uri($arg, $ls_ok)) { + $_[1] = $$uri; # canonicalized push @{$self->{nntp_order}}, $uri; } else { push @{$self->{unsupported_url}}, $arg; -- cgit v1.2.3-24-ge0c7