mirror of
https://github.com/discourse/discourse.git
synced 2025-01-31 06:09:30 +08:00
FIX: Ensure 'tr' is called on a string. (#11853)
It depends on the route, but sometimes 'id' parameter can contain a slug-like value and sometimes it is just an ID. This should work in both cases.
This commit is contained in:
parent
60515547bc
commit
7be556fc19
|
@ -819,7 +819,7 @@ class ApplicationController < ActionController::Base
|
||||||
|
|
||||||
params[:slug] = params[:slug].first if params[:slug].kind_of?(Array)
|
params[:slug] = params[:slug].first if params[:slug].kind_of?(Array)
|
||||||
params[:id] = params[:id].first if params[:id].kind_of?(Array)
|
params[:id] = params[:id].first if params[:id].kind_of?(Array)
|
||||||
@slug = (params[:slug].presence || params[:id].presence || "").tr('-', ' ')
|
@slug = (params[:slug].presence || params[:id].presence || "").to_s.tr('-', ' ')
|
||||||
|
|
||||||
render_to_string status: opts[:status], layout: opts[:layout], formats: [:html], template: '/exceptions/not_found'
|
render_to_string status: opts[:status], layout: opts[:layout], formats: [:html], template: '/exceptions/not_found'
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user