More gracefully deals with gophermap errors

This commit is contained in:
sloum 2023-07-07 19:55:26 -07:00
parent 6dfa2c52bb
commit 9d4b5a2763
1 changed files with 5 additions and 2 deletions

View File

@ -111,9 +111,12 @@ func splitGopherLine(l string) gopherLine {
out.text = parts[0][1:]
out.text = strings.TrimRight(parts[0][1:], "\n\r ")
}
if len(parts) > 1 {
if len(parts) >= 4 {
out.url = "gopher://" + parts[2] + ":" + parts[3] + "/" + string(out.gType) + parts[1]
}
} else {
out.gType = 'i'
out.text = ""
}
return out
}