aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch
diff options
context:
space:
mode:
authorJosua Schmid <josua.schmid@renuo.ch>2019-02-12 16:58:59 +0100
committerJosua Schmid <josua.schmid@renuo.ch>2019-03-26 13:53:41 +0100
commit25f2e0c39da2b9c61db75df2d767ee9c10d583b8 (patch)
treeb87fef53330be34a1ddd271af5e0ea2d49a42ba7 /actionpack/lib/action_dispatch
parent08a435fa8c2307e78436eeaad43bfae7a54b2ab4 (diff)
downloadrails-25f2e0c39da2b9c61db75df2d767ee9c10d583b8.tar.gz
rails-25f2e0c39da2b9c61db75df2d767ee9c10d583b8.tar.bz2
rails-25f2e0c39da2b9c61db75df2d767ee9c10d583b8.zip
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.
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb4
1 files changed, 4 insertions, 0 deletions
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