shithub: gemnine

Download patch

ref: fde607e0baa42408694197787654ebcd4b69d6f4
parent: 980c12a177a929e6cbee92aaeb1a1e5e25f8bab2
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Sun May 17 12:58:53 EDT 2020

make sure to not add extra / to relative URLs

--- a/main.c
+++ b/main.c
@@ -220,10 +220,13 @@
 					while(isspace(*t))
 						t++;
 					u = t;
-					if((t = strpbrk(t, " :/")) == nil || t[0] != ':' || t[1] != '/' || t[2] != '/') /* relative URL */
+					if((t = strpbrk(t, " :/")) == nil || t[0] != ':' || t[1] != '/' || t[2] != '/'){ /* relative URL */
+						if(*u == '/')
+							u++;
 						Bprint(&out, "=> gemini://%s:%s/%s\n", r->url->server, r->url->port, u);
-					else
+					}else{
 						Bprint(&out, "%s\n", s);
+					}
 				}else{
 					Bprint(&out, "%s\n", s);
 				}