X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/agedu/blobdiff_plain/256c29a27ba79677a78bc676a3cc73ee1aad2d68..cfe942fb3391ae80e816272d7baa45be30e5e7ec:/html.c diff --git a/html.c b/html.c index be13590..0d80eae 100644 --- a/html.c +++ b/html.c @@ -446,7 +446,7 @@ char *html_query(const void *t, unsigned long index, */ htprintf(ctx, "

\n"); q = path; - for (p = strchr(path, pathsep); p; p = strchr(p, pathsep)) { + for (p = strchr(path, pathsep); p && p[1]; p = strchr(p, pathsep)) { int doing_href = 0; char c, *zp; @@ -466,6 +466,8 @@ char *html_query(const void *t, unsigned long index, trie_getpath(t, index2, path2); if (!strcmp(path, path2) && cfg->format) { snprintf(href, hreflen, cfg->format, index2); + if (!*href) /* special case that we understand */ + strcpy(href, "./"); htprintf(ctx, "", href); doing_href = 1; }