From 6a54da0902150e5b8c49ef953cb13676108c4933 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 29 Jun 2018 10:43:33 +1000 Subject: [PATCH] FIX: raise invalid params for bad callback Corrects it so we raise a 400 instead of logged 500 error --- app/controllers/groups_controller.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index 5ef668485ec..259f74db544 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -69,7 +69,11 @@ class GroupsController < ApplicationController end if type = params[:type]&.to_sym - groups = TYPE_FILTERS[type].call(groups, current_user) + callback = TYPE_FILTERS[type] + if !callback + raise Discourse::InvalidParameters.new(:type) + end + groups = callback.call(groups, current_user) end if current_user