mirror of
https://github.com/riwiwa/muzi.git
synced 2025-12-30 04:35:26 -08:00
fixed history bug where site didn't load if url query was blank
This commit is contained in:
2
main.go
2
main.go
@@ -68,6 +68,6 @@ func main() {
|
||||
return
|
||||
}
|
||||
|
||||
//importsongs.ImportSpotify()
|
||||
importsongs.ImportSpotify()
|
||||
web.Start()
|
||||
}
|
||||
|
||||
@@ -106,12 +106,18 @@ 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 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
|
||||
off := 0 + (25 * (pageInt - 1))
|
||||
|
||||
Reference in New Issue
Block a user