diff options
| author | Paul Wise <pabs3@bonedaddy.net> | 2023-04-09 12:41:42 +0800 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2023-05-27 14:24:40 -0300 |
| commit | 6d383d404982c6e12dd68dcdf94b3490e3de4645 (patch) | |
| tree | 16b5071b3dbb8c04c258dc0047e96f4624eae672 /contrib | |
| parent | d155f29eca0ab9afc35292e447fb67b1c73e9df9 (diff) | |
notmuch-mutt: fix Xapian query construction
Spaces need to be stripped when querying the Message-Id,
because notmuch stores them in Xapian with spaces stripped.
All double-quote characters need to be doubled to escape them,
otherwise they will be added as extra query terms outside the id.
Diffstat (limited to 'contrib')
| -rwxr-xr-x | contrib/notmuch-mutt/notmuch-mutt | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/contrib/notmuch-mutt/notmuch-mutt b/contrib/notmuch-mutt/notmuch-mutt index 1e12038c..b38258f5 100755 --- a/contrib/notmuch-mutt/notmuch-mutt +++ b/contrib/notmuch-mutt/notmuch-mutt @@ -124,7 +124,11 @@ sub thread_action($$@) { empty_maildir($results_dir); die "notmuch-mutt: cannot find Message-Id, abort.\n"; } - my $search_cmd = 'notmuch search --output=threads ' . shell_quote("id:$mid"); + + $mid =~ s/ //g; # notmuch strips spaces before storing Message-Id + $mid =~ s/"/""/g; # escape all double quote characters + + my $search_cmd = 'notmuch search --output=threads ' . shell_quote(qq{id:"$mid"}); my $tid = `$search_cmd`; # get thread id chomp($tid); @@ -135,7 +139,10 @@ sub tag_action(@) { my $mid = get_message_id(); defined $mid or die "notmuch-mutt: cannot find Message-Id, abort.\n"; - system("notmuch", "tag", @_, "--", "id:$mid"); + $mid =~ s/ //g; # notmuch strips spaces before storing Message-Id + $mid =~ s/"/""/g; # escape all double quote characters + + system("notmuch", "tag", @_, "--", qq{id:"$mid"}); } sub die_usage() { |
