From c19df6c1210889c1699777c20fb4bed81a6196b6 Mon Sep 17 00:00:00 2001 From: Masterjun3 Date: Tue, 26 Nov 2024 12:38:52 +0100 Subject: [PATCH] search: make page number resilient against negative values --- TASVideos/Pages/Search/Advanced.cshtml.cs | 1 + TASVideos/Pages/Search/Index.cshtml.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/TASVideos/Pages/Search/Advanced.cshtml.cs b/TASVideos/Pages/Search/Advanced.cshtml.cs index e8ff6e30d..9f625580d 100644 --- a/TASVideos/Pages/Search/Advanced.cshtml.cs +++ b/TASVideos/Pages/Search/Advanced.cshtml.cs @@ -14,6 +14,7 @@ public class AdvancedModel(ApplicationDbContext db) : BasePageModel public string SearchTerms { get; set; } = ""; [FromQuery] + [Range(1, int.MaxValue)] public int PageNumber { get; set; } = 1; public List PageResults { get; set; } = []; diff --git a/TASVideos/Pages/Search/Index.cshtml.cs b/TASVideos/Pages/Search/Index.cshtml.cs index 936c01668..afd7f2002 100644 --- a/TASVideos/Pages/Search/Index.cshtml.cs +++ b/TASVideos/Pages/Search/Index.cshtml.cs @@ -13,6 +13,7 @@ public class IndexModel(ApplicationDbContext db) : BasePageModel public string SearchTerms { get; set; } = ""; [FromQuery] + [Range(1, int.MaxValue)] public int PageNumber { get; set; } = 1; public List PageResults { get; set; } = [];