ui-shared: URL-escape script_name

As far as I know, there is no requirement that $SCRIPT_NAME contain only
URL-safe characters, so we need to make sure that any special characters
are escaped.

Signed-off-by: John Keeping <john@keeping.me.uk>
lf/filter
John Keeping 11 years ago committed by Jason A. Donenfeld
parent d1a6ece439
commit a45030f8ee

@ -139,7 +139,7 @@ static void site_url(const char *page, const char *search, const char *sort, int
if (ctx.cfg.virtual_root) if (ctx.cfg.virtual_root)
html_attr(ctx.cfg.virtual_root); html_attr(ctx.cfg.virtual_root);
else else
html(ctx.cfg.script_name); html_url_path(ctx.cfg.script_name);
if (page) { if (page) {
htmlf("?p=%s", page); htmlf("?p=%s", page);
@ -219,7 +219,7 @@ static char *repolink(const char *title, const char *class, const char *page,
html_url_path(path); html_url_path(path);
} }
} else { } else {
html(ctx.cfg.script_name); html_url_path(ctx.cfg.script_name);
html("?url="); html("?url=");
html_url_arg(ctx.repo->url); html_url_arg(ctx.repo->url);
if (ctx.repo->url[strlen(ctx.repo->url) - 1] != '/') if (ctx.repo->url[strlen(ctx.repo->url) - 1] != '/')

Loading…
Cancel
Save