From: Richard Russon Date: Tue, 30 Jan 2018 14:56:46 +0000 (+0000) Subject: fix parsing of urls containing '?' X-Git-Tag: neomutt-20180223~26 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=618010fb5e02956536169d91605c1b072a98a21c;p=neomutt fix parsing of urls containing '?' The URL schemes come in two patterns - smtp://user:pass@host - notmuch:///path?query The 'host' types don't take a query string. 'notmuch' and 'mailto' don't use a 'user:pass' string. This fix will still be confused by a notmuch URL that has a '?' in the path component, but no query string. (but I don't think the code ever coped with that). e.g. - notmuch:///dir?name/ Fixes #1043 --- diff --git a/url.c b/url.c index d6d9ad123..8adea2cab 100644 --- a/url.c +++ b/url.c @@ -174,12 +174,20 @@ int url_parse(struct Url *u, char *src) src += 2; - t = strchr(src, '?'); - if (t) + /* Notmuch and mailto schemes can include a query */ +#ifdef USE_NOTMUCH + if ((u->scheme == U_NOTMUCH) || (u->scheme == U_MAILTO)) +#else + if (u->scheme == U_MAILTO) +#endif { - *t++ = '\0'; - if (parse_query_string(u, t) < 0) - goto err; + t = strrchr(src, '?'); + if (t) + { + *t++ = '\0'; + if (parse_query_string(u, t) < 0) + goto err; + } } u->path = strchr(src, '/');