diff options
author | Eric Wong <e@80x24.org> | 2021-05-04 05:14:19 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-05-04 05:14:53 +0000 |
commit | 5822bd37808c1ac21863d37161b19f1021657a58 (patch) | |
tree | 3c7a6f0529815b629a3a3a597174a82e3123806b /lib/PublicInbox/LeiLsMailSync.pm | |
parent | 7453aefc22817eb0de9c7afafa3c43acde0e0b07 (diff) | |
download | public-inbox-5822bd37808c1ac21863d37161b19f1021657a58.tar.gz |
If lei_ls_mail_sync() is given a filter without any wildcards and --globoff is unspecified, glob2re() will return undef, resulting in the final regular expression being undefined. Always use a fallback value when there's no RE. Based-on-patch-by: Kyle Meyer <kyle@kyleam.com> Link: https://public-inbox.org/meta/20210504044559.12941-5-kyle@kyleam.com/
Diffstat (limited to 'lib/PublicInbox/LeiLsMailSync.pm')
-rw-r--r-- | lib/PublicInbox/LeiLsMailSync.pm | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/PublicInbox/LeiLsMailSync.pm b/lib/PublicInbox/LeiLsMailSync.pm index 532ea9b5..505c0b3f 100644 --- a/lib/PublicInbox/LeiLsMailSync.pm +++ b/lib/PublicInbox/LeiLsMailSync.pm @@ -12,9 +12,8 @@ sub lei_ls_mail_sync { my $sto = $lei->_lei_store or return; my $lms = $sto->search->lms or return; my $opt = $lei->{opt}; - my $re; - $re = defined($filter) ? qr/\Q$filter\E/ : qr/./ if $opt->{globoff}; - $re //= $lei->glob2re($filter // '*'); + my $re = $opt->{globoff} ? undef : $lei->glob2re($filter // '*'); + $re //= qr/\Q$filter\E/; my @f = $lms->folders; @f = $opt->{'invert-match'} ? grep(!/$re/, @f) : grep(/$re/, @f); if ($opt->{'local'} && !$opt->{remote}) { |