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 return
} }
//importsongs.ImportSpotify() importsongs.ImportSpotify()
web.Start() web.Start()
} }

View File

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