From 590a9e020ab85d6d75ef001eeb31c6e8f81016d8 Mon Sep 17 00:00:00 2001 From: serr Date: Sun, 2 Feb 2025 16:55:15 +0300 Subject: [PATCH] returns add to PageValidationMiddleware --- mvc/controllers/middlewares.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mvc/controllers/middlewares.go b/mvc/controllers/middlewares.go index 527832f..c9ff53f 100644 --- a/mvc/controllers/middlewares.go +++ b/mvc/controllers/middlewares.go @@ -65,11 +65,13 @@ func PageValidationMiddleware(s *models.Site) gin.HandlerFunc { if pageNumber > len(s.Posts) || pageNumber < 1 { c.Redirect(http.StatusFound, "/index/1?Нет доступа") c.Abort() + return } case "index", "AJAXindex": if pageNumber > s.Posts.GetMaxPageNumber() || pageNumber < 1 { c.Redirect(http.StatusFound, "/index/1?Нет доступа") c.Abort() + return } case "search", "AJAXsearch": searchSubstring := c.Query("search") @@ -79,11 +81,13 @@ func PageValidationMiddleware(s *models.Site) gin.HandlerFunc { c.Redirect(http.StatusFound, "/index/1?Нет доступа") c.Abort() + return } default: if pageNumber != 1 { c.Redirect(http.StatusFound, "/index/1?Нет доступа") c.Abort() + return } }