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
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, '/');