Commit Diff


commit - a9c69469e23f6f2f05cae0ee0bd2b917c315dec2
commit + 54acddc996a4ca728b55db1359b4f39ea724c393
blob - 88324f7fc93c64ddf5f2bcbc9237c3ad5bee2954
blob + 15cd457dabfef276f565105f7b23f8f0e9a48cc2
--- fragments.tmpl
+++ fragments.tmpl
@@ -24,6 +24,7 @@
 #include <event.h>
 #include <limits.h>
 #include <stdint.h>
+#include <string.h>
 
 #include "galileo.h"
 
@@ -65,9 +66,20 @@ gemini://{{ host }}{{ path }}
 
 {{ define tp_figure(struct template *tp, const char *url,
     const char *label) }}
+{!
+	struct client	*clt = tp->tp_arg;
+	const char	*path = "";
+	int		 relativify;
+
+	relativify = *url == '/' || strstr(url, "//") == NULL;
+	if (relativify) {
+		path = clt->clt_script_name;
+		url++; /* skip leading / */
+	}
+!}
 <figure>
-	<a href="{{ url | urlescape }}">
-		<img src="{{ url }}" />
+	<a href="{{ path | urlescape }}{{ url | urlescape }}">
+		<img src="{{ path | urlescape }}{{ url }}" />
 	</a>
 	<figcaption>
 		{{ label }}
blob - 296aa30fb1f3973b772c785b45e753a91cbf737f
blob + afe0005e65e130c9d747fdc7ffa3527c49acd8a3
--- proxy.c
+++ proxy.c
@@ -733,7 +733,8 @@ proxy_error(struct bufferevent *bev, short err, void *
 			clt->clt_translate &= ~TR_NAV;
 		}
 
-		if (tp_foot(clt->clt_tp) == -1)
+		if (clt->clt_translate &&
+		    tp_foot(clt->clt_tp) == -1)
 			return;
 	}