~ft/gemnine

22965fbf81ab54511ca4fa66d4e4e597d373be42 — Sigrid Haflínudóttir 2 years ago 3082e1e
urlto: fix relative when there is no / in the url at all
1 files changed, 4 insertions(+), 4 deletions(-)

M main.c
M main.c => main.c +4 -4
@@ 55,11 55,11 @@ urlto(Url *url, char *u)

	/* relative, no scheme */
	len = strlen(url->url);
	if(url->url[len-1] == '/') /* easy */
		u = smprint("%s/%s%s", url->url, u, trail);
	else{
	if(url->url[len-1] == '/'){ /* easy */
		u = smprint("%s%s%s", url->url, u, trail);
	}else{
		/* replace the last element */
		if((e = strrchr(url->url, '/')) != nil)
		if((e = strrchr(url->url, '/')) != nil && e[-1] != '/')
			len = e - url->url;
		u = smprint("%.*s/%s%s", len, url->url, u, trail);
	}