From 25f2e0c39da2b9c61db75df2d767ee9c10d583b8 Mon Sep 17 00:00:00 2001 From: Josua Schmid Date: Tue, 12 Feb 2019 16:58:59 +0100 Subject: Raise if resource custom params contain colons After this change it's not possible anymore to configure routes like this: routes.draw do resources :users, param: "name/:sneaky" end Fixes #30467. --- actionpack/lib/action_dispatch/routing/mapper.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'actionpack/lib/action_dispatch/routing') diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index da3ade652e..2d2073de9a 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -1141,6 +1141,10 @@ module ActionDispatch attr_reader :controller, :path, :param def initialize(entities, api_only, shallow, options = {}) + if options[:param].to_s.include?(":") + raise ArgumentError, ":param option can't contain colons" + end + @name = entities.to_s @path = (options[:path] || @name).to_s @controller = (options[:controller] || @name).to_s -- cgit v1.2.3