Clean up the shorts list

This commit is contained in:
Ian Gulliver
2024-12-06 12:07:18 -08:00
parent a61e497f2a
commit 65b9782486

12
main.go
View File

@@ -288,9 +288,17 @@ func (sl *ShortLinks) serveSuggest(w http.ResponseWriter, r *http.Request) {
return
}
out.Domain = sl.getDomain(r.Host)
send := &suggestResponse{
Domain: sl.getDomain(r.Host),
}
sendJSON(w, out)
for _, short := range out.Shorts {
if short != "" {
send.Shorts = append(send.Shorts, strings.ToLower(strings.TrimSpace(short)))
}
}
sendJSON(w, send)
}
func (sl *ShortLinks) serveHelp(w http.ResponseWriter, r *http.Request) {