From 509500a9d2b00873e0b4484c4956e58a2ef6d83c Mon Sep 17 00:00:00 2001 From: djcb Date: Fri, 27 Oct 2017 18:43:33 +0300 Subject: [PATCH] server: update query processing fix quoting issues with mu4e --- lib/mu-query.cc | 4 +++- lib/mu-str.c | 1 + lib/tests/test-mu-store.c | 3 ++- lib/tests/test-mu-str.c | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/mu-query.cc b/lib/mu-query.cc index 8a495151..9217339a 100644 --- a/lib/mu-query.cc +++ b/lib/mu-query.cc @@ -93,7 +93,9 @@ struct MuProc: public Mux::ProcIface { if (!name || !pfx) return; - fields.push_back ({{name}, {pfx}, id}); + fields.push_back ({{name}, {pfx}, + mu_msg_field_xapian_index(id), + id}); } std::vector diff --git a/lib/mu-str.c b/lib/mu-str.c index fdb58178..22043f71 100644 --- a/lib/mu-str.c +++ b/lib/mu-str.c @@ -557,6 +557,7 @@ read_val (const char *str, const char **endval, GError **err) } } else if (*cur == '"') { quoted = !quoted; + g_string_append_c (gstr, *cur); continue; } else if (isblank(*cur) && !quoted) break; diff --git a/lib/tests/test-mu-store.c b/lib/tests/test-mu-store.c index 3d0fe5e6..a315f412 100644 --- a/lib/tests/test-mu-store.c +++ b/lib/tests/test-mu-store.c @@ -175,7 +175,8 @@ test_mu_store_store_msg_remove_and_count (void) g_assert_cmpuint (0,==,mu_store_count (store, NULL)); g_assert_cmpuint (FALSE,==,mu_store_contains_message (store, - MU_TESTMAILDIR "/cur/1283599333.1840_11.cthulhu!2,", NULL)); + MU_TESTMAILDIR "/cur/1283599333.1840_11.cthulhu!2,", + NULL)); g_free (tmpdir); mu_store_unref (store); } diff --git a/lib/tests/test-mu-str.c b/lib/tests/test-mu-str.c index 1aea1e45..0bcb4dad 100644 --- a/lib/tests/test-mu-str.c +++ b/lib/tests/test-mu-str.c @@ -113,7 +113,7 @@ test_parse_arglist (void) GHashTable *hash; GError *err; - args = "cmd:find query:\"maildir:\\\"/sent items\\\"\" maxnum:500"; + args = "cmd:find query:maildir:\"/sent items\" maxnum:500"; err = NULL; hash = mu_str_parse_arglist (args, &err);