about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiSavedSearch.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-11-08 23:39:26 +0000
committerEric Wong <e@80x24.org>2021-11-09 00:43:36 +0000
commit666dde69a3f64456321b7c701070712d6b85e359 (patch)
treee5efd7c440bcc8d84e04e00651f04224761c8a4e /lib/PublicInbox/LeiSavedSearch.pm
parent7ffa98cbbf5bff8225fdfedb0f2b7c2beb5d0a6f (diff)
downloadpublic-inbox-666dde69a3f64456321b7c701070712d6b85e359.tar.gz
`"' (double-quote) needs to be quoted for stdin searches.

We also need to differentiate between "lei q --stdin" usage
when calling "lei up", do it by setting an internal "rawstr"
knob to ensure we can parse the config properly regardless
of whether the initial search used --stdin or not.
Diffstat (limited to 'lib/PublicInbox/LeiSavedSearch.pm')
-rw-r--r--lib/PublicInbox/LeiSavedSearch.pm5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/PublicInbox/LeiSavedSearch.pm b/lib/PublicInbox/LeiSavedSearch.pm
index b2f1ad10..1d13aef6 100644
--- a/lib/PublicInbox/LeiSavedSearch.pm
+++ b/lib/PublicInbox/LeiSavedSearch.pm
@@ -21,6 +21,7 @@ my %cquote = ("\n" => '\\n', "\t" => '\\t', "\b" => '\\b');
 sub cquote_val ($) { # cf. git-config(1)
         my ($val) = @_;
         $val =~ s/([\n\t\b])/$cquote{$1}/g;
+        $val =~ s/\"/\\\"/g;
         $val;
 }
 
@@ -162,6 +163,10 @@ EOM
                 my $val = $lei->{opt}->{$k} // next;
                 print $fh "\t$k = $val\n";
         }
+        $lei->{opt}->{stdin} and print $fh <<EOM;
+[lei "internal"]
+        rawstr = 1 # stdin was used initially
+EOM
         close($fh) or return $lei->fail("close $f: $!");
         $self->{lock_path} = "$self->{-f}.flock";
         $self->{-ovf} = "$dir/over.sqlite3";