]> Sergey Matveev's repositories - public-inbox.git/commitdiff
net_reader: canonicalize URL args on add_url
authorEric Wong <e@80x24.org>
Sat, 12 Jun 2021 00:10:45 +0000 (00:10 +0000)
committerEric Wong <e@80x24.org>
Sun, 13 Jun 2021 17:39:38 +0000 (17:39 +0000)
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

index bcc6cbf084db58689e97f3ae15d6727367432265..30784199e5b7018b5bbced09da66cff91525f971 100644 (file)
@@ -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;