about summary refs log tree commit homepage
path: root/lib/PublicInbox
diff options
authorEric Wong <e@80x24.org>2021-11-10 10:28:37 +0000
committerEric Wong <e@80x24.org>2021-11-10 18:38:15 +0000
commit1fb061098abd9a9ad8f018b0583071e19ffc9fec (patch)
tree344e6a086a76e270d46c7642091bb08a0baf531a /lib/PublicInbox
parent878604bada08970f8bfedc2e9efa687fbec0edbd (diff)
For --stdin searches created prior to commit 666dde69a3f6 (lei
q|up: fix saved searches for single-phrase search, 2021-11-08)
we still want to be able to run "lei up" on them without
regressions.  So assume nobody manages to enter "\n" as an
argv[] element and consider the presence of "\n" as a previous
--stdin use.

This fixes errors from "lei up" such as:

  lei_xsearch 2 wq_worker: Exception: Key too long: length was 840 bytes,
  maximum length of a key is 255 bytes at ../PublicInbox/IPC.pm line 250.

Fixes: 666dde69a3f6 ("lei q|up: fix saved searches for single-phrase search")
Diffstat (limited to 'lib/PublicInbox')
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/PublicInbox/LeiUp.pm b/lib/PublicInbox/LeiUp.pm
index d7873a3f..b8a98360 100644
--- a/lib/PublicInbox/LeiUp.pm
+++ b/lib/PublicInbox/LeiUp.pm
@@ -29,7 +29,9 @@ sub up1 ($$) {
         my $q = $lss->{-cfg}->get_all('lei.q') //
                                 die("lei.q unset in $f (out=$out)\n");
         my $lse = $lei->{lse} // die 'BUG: {lse} missing';
-        if ($lss->{-cfg}->{'lei.internal.rawstr'}) {
+        my $rawstr = $lss->{-cfg}->{'lei.internal.rawstr'} //
+                (scalar(@$q) == 1 && substr($q->[0], -1) eq "\n");
+        if ($rawstr) {
                 scalar(@$q) > 1 and
                         die "$f: lei.q has multiple values (@$q) (out=$out)\n";
                 $lse->query_approxidate($lse->git, $mset_opt->{qstr} = $q->[0]);