fixed history bug where site didn't load if url query was blank

This commit is contained in:
2025-12-20 05:49:04 -08:00
parent 4cb8b94445
commit 4cc7649772
2 changed files with 11 additions and 5 deletions

View File

@@ -68,6 +68,6 @@ func main() {
return
}
//importsongs.ImportSpotify()
importsongs.ImportSpotify()
web.Start()
}

View File

@@ -106,11 +106,17 @@ func tmp(w http.ResponseWriter, r *http.Request) {
}
defer conn.Close(context.Background())
var pageInt int
pageStr := r.URL.Query().Get("page")
pageInt, err := strconv.Atoi(pageStr)
if err != nil {
fmt.Fprintf(os.Stderr, "Cannot convert page URL query from string to int: %v\n", err)
return
if pageStr == "" {
pageInt = 1
} else {
pageInt, err = strconv.Atoi(pageStr)
if err != nil {
fmt.Fprintf(os.Stderr, "Cannot convert page URL query from string to int: %v\n", err)
return
}
}
lim := 25