mu4e: work around quoting issues

Use base-64 for now.
This commit is contained in:
djcb 2017-10-28 18:23:08 +03:00
parent 2d94ff856e
commit 4ee8c5e1d6
2 changed files with 12 additions and 2 deletions

View File

@ -949,6 +949,7 @@ cmd_find (ServerContext *ctx, GHashTable *args, GError **err)
MuMsgFieldId sortfield; MuMsgFieldId sortfield;
const char *querystr; const char *querystr;
MuQueryFlags qflags; MuQueryFlags qflags;
char *query;
GET_STRING_OR_ERROR_RETURN (args, "query", &querystr, err); GET_STRING_OR_ERROR_RETURN (args, "query", &querystr, err);
if (get_find_params (args, &sortfield, &maxnum, &qflags, err) if (get_find_params (args, &sortfield, &maxnum, &qflags, err)
@ -957,12 +958,21 @@ cmd_find (ServerContext *ctx, GHashTable *args, GError **err)
return MU_OK; return MU_OK;
} }
{
char *s;
gsize len;
s = (char*)g_base64_decode (querystr, &len);
query = g_strndup (s, len);
g_free (s);
}
/* note: when we're threading, we get *all* matching messages, /* note: when we're threading, we get *all* matching messages,
* and then only return maxnum; this is so that we maximimize * and then only return maxnum; this is so that we maximimize
* the change of all messages in a thread showing up */ * the change of all messages in a thread showing up */
iter = mu_query_run (ctx->query, querystr, sortfield, iter = mu_query_run (ctx->query, query, sortfield,
maxnum, qflags, err); maxnum, qflags, err);
g_free (query);
if (!iter) { if (!iter) {
print_and_clear_g_error (err); print_and_clear_g_error (err);
return MU_OK; return MU_OK;

View File

@ -339,7 +339,7 @@ or an error."
(concat (concat
"cmd:find query:%s threads:%s sortfield:%s reverse:%s maxnum:%d " "cmd:find query:%s threads:%s sortfield:%s reverse:%s maxnum:%d "
"skip-dups:%s include-related:%s") "skip-dups:%s include-related:%s")
(format "%s" query) (base64-encode-string query)
(if threads "true" "false") (if threads "true" "false")
;; sortfield is e.g. ':subject'; this removes the ':' ;; sortfield is e.g. ':subject'; this removes the ':'
(if (null sortfield) "nil" (substring (symbol-name sortfield) 1)) (if (null sortfield) "nil" (substring (symbol-name sortfield) 1))