mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 18:30:26 -06:00
FIX: ensures slug and id are not arrays (#8495)
If for some reason an URL was create in this format: ``` ?slug[]=foo&slug[]=bar ``` This would have create an exception of this kind: ``` NoMethodError (undefined method `tr' for ["foo", "bar"]:Array Did you mean? try) ```
This commit is contained in:
parent
f5396e2700
commit
47731175f4
@ -790,6 +790,9 @@ class ApplicationController < ActionController::Base
|
||||
@title = opts[:title] || I18n.t("page_not_found.title")
|
||||
@group = opts[:group]
|
||||
@hide_search = true if SiteSetting.login_required
|
||||
|
||||
params[:slug] = params[:slug].first if params[:slug].kind_of?(Array)
|
||||
params[:id] = params[:id].first if params[:id].kind_of?(Array)
|
||||
@slug = (params[:slug].presence || params[:id].presence || "").tr('-', ' ')
|
||||
|
||||
render_to_string status: opts[:status], layout: opts[:layout], formats: [:html], template: '/exceptions/not_found'
|
||||
|
Loading…
Reference in New Issue
Block a user