added /sitemap/index and return 400 if index parsing fails

This commit is contained in:
2023-03-09 12:15:43 +01:00
parent 1cae00e85d
commit 7a5acb5fc3

View File

@@ -1089,7 +1089,7 @@ func getSiteMap(c *gin.Context) {
id, err := strconv.Atoi(c.Param("id"))
if err != nil {
_ = c.AbortWithError(http.StatusInternalServerError, err)
_ = c.AbortWithError(http.StatusBadRequest, err)
return
}
@@ -1291,6 +1291,8 @@ func main() {
r.GET("/matches/next/:time", getMatches)
r.GET("/sitemap.xml", getSiteMapIndex)
r.HEAD("/sitemap.xml", getSiteMapIndex)
r.GET("/sitemap/index", getSiteMapIndex)
r.HEAD("/sitemap/index", getSiteMapIndex)
r.GET("/sitemap/:id", getSiteMap)
r.HEAD("/sitemap/:id", getSiteMap)