FIX: Don't error out on nested topic show id param (#29274)

We're expecting the ID param to be something that neatly coerces into an ID. If we receive something like a nested parameter, this will blow up. (We already handle the case of arrays.)

This commit raises an InvalidParameters exception in the case of a nested ID.
This commit is contained in:
Ted Johansson
2024-10-18 14:37:52 +08:00
committed by GitHub
parent 9dafbe47dc
commit f8360f9665
2 changed files with 7 additions and 1 deletions

View File

@ -51,7 +51,7 @@ class TopicsController < ApplicationController
end
def show
if params[:id].is_a?(Array)
if params[:id].is_a?(Array) || params[:id].is_a?(ActionController::Parameters)
raise Discourse::InvalidParameters.new("Show only accepts a single ID")
end