FIX: Don't error out on nested categories index page param (#29273)

We're expecting the page param to be something that neatly coerces into an integer. If we receive something like a nested parameter, this will blow up. (I'm sure there are other examples as well.)

This commit falls back to a page value of 1 if the coercion fails.
This commit is contained in:
Ted Johansson
2024-10-18 14:37:39 +08:00
committed by GitHub
parent 48308a5ee6
commit 9dafbe47dc
2 changed files with 6 additions and 1 deletions

View File

@ -620,7 +620,7 @@ class CategoriesController < ApplicationController
include_topics: include_topics,
include_subcategories: include_subcategories,
tag: params[:tag],
page: params[:page].to_i,
page: params[:page].try(:to_i) || 1,
}
@category_list = CategoryList.new(guardian, category_options)