]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
config: ignore blank address= and listid= entries
authorEric Wong <e@80x24.org>
Mon, 16 Sep 2024 21:02:58 +0000 (21:02 +0000)
committerEric Wong <e@80x24.org>
Tue, 17 Sep 2024 23:35:38 +0000 (23:35 +0000)
At the minimum, there must be a non-space character in
address= and listid= entries for matches to occur.
Filter out the obviously unmatchable entries here to
avoid potential problems elsewhere.

lib/PublicInbox/Config.pm

index cda3045e6348f464ed777e08d181c6f7b3dc0667..d76deca408348f1c123384ae3342444b2ae245f7 100644 (file)
@@ -492,16 +492,14 @@ sub _fill_ibx {
        ($ibx->{name}) = keys %dedupe; # used as a key everywhere
        $ibx->{-pi_cfg} = $self;
        $ibx = PublicInbox::Inbox->new($ibx);
-       foreach (@{$ibx->{address}}) {
+       for (grep /\S/, @{$ibx->{address}}) {
                my $lc_addr = lc($_);
                $self->{-by_addr}->{$lc_addr} = $ibx;
                $self->{-no_obfuscate}->{$lc_addr} = 1;
        }
-       if (my $listids = $ibx->{listid}) {
-               # RFC2919 section 6 stipulates "case insensitive equality"
-               foreach my $list_id (@$listids) {
-                       $self->{-by_list_id}->{lc($list_id)} = $ibx;
-               }
+       # RFC2919 section 6 stipulates "case insensitive equality"
+       for my $list_id (grep /\S/, @{$ibx->{listid} // []}) {
+               $self->{-by_list_id}->{lc($list_id)} = $ibx;
        }
        if (defined(my $ngname = $ibx->{newsgroup})) {
                if (ref($ngname)) {