Checked page parameter to ensure a integer numeric value is provided. (#8644)

This commit is contained in:
Andrea Piovanelli 2023-01-13 09:00:54 +01:00 committed by GitHub
parent 2a1b0b3af3
commit eed4a6a11b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -51,7 +51,11 @@ namespace Orchard.Taxonomies.Drivers {
var pagerParameters = new PagerParameters();
var httpContext = _httpContextAccessor.Current();
if (httpContext != null) {
pagerParameters.Page = Convert.ToInt32(httpContext.Request.QueryString["page"]);
// Check if "page" parameter is a valid number.
int page = 0;
if (int.TryParse(httpContext.Request.QueryString["page"], out page)) {
pagerParameters.Page = page;
}
}
var pager = new Pager(_siteService.GetSiteSettings(), pagerParameters);