summary refs log tree commit diff
diff options
context:
space:
mode:
authorwrmr2024-11-09 01:57:10 -0500
committerwrmr2024-11-09 01:57:10 -0500
commit12d5d0df5c4b958bbb5cc339a9e556c50136a974 (patch)
tree02d07576859f0a3b7197886d5d7c224a5693cb76
parentcbb9f606333774f4de6f639891cd1411419ecf2a (diff)
fix gophermaps not terminating on final .
-rw-r--r--parse.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/parse.c b/parse.c
index 8ea90f8..40f7a25 100644
--- a/parse.c
+++ b/parse.c
@@ -48,6 +48,7 @@ size_t scatss(char *buf, size_t i, size_t n, strv_t ss) {
 }
 
 int parse_gophermap_line(struct doc *d, strv_t ln) {
+	if (ln.n == 1 && ln.s[0] == '.') return 1;
 	char url[512] = "gopher://";
 	size_t urln = 9;
 	struct {
@@ -63,8 +64,6 @@ int parse_gophermap_line(struct doc *d, strv_t ln) {
 	strv_split(&ln, '\t', &bits.host);
 	strv_split(&ln, '\t', &bits.port);
 	switch (bits.item_type) {
-	case '.':
-		if (ln.n == 1) return 1;
 	default:
 		urln = scatss(url, urln, sizeof url, bits.host);
 		if (urln < sizeof url) url[urln++] = ':';