FIX: Validate page/limit params for directory, user-badges and groups (#22877)

We'll now return a 400 error instead of 500. 400 is a better description of the issue, and also avoids creating unnecessary noise in the logs.
This commit is contained in:
David Taylor
2023-07-31 15:00:05 +01:00
committed by GitHub
parent 984dd89cb4
commit 6e8e3c3151
7 changed files with 51 additions and 12 deletions

View File

@ -88,7 +88,7 @@ class GroupsController < ApplicationController
# count the total before doing pagination
total = groups.count
page = params[:page].to_i
page = fetch_int_from_params(:page, default: 0)
page_size = MobileDetection.mobile_device?(request.user_agent) ? 15 : 36
groups = groups.offset(page * page_size).limit(page_size)