actionpack 5.0.2 → 5.0.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of actionpack might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +91 -0
- data/lib/action_controller/base.rb +6 -0
- data/lib/action_controller/metal.rb +1 -1
- data/lib/action_controller/metal/strong_parameters.rb +180 -34
- data/lib/action_controller/railtie.rb +1 -0
- data/lib/action_controller/renderer.rb +1 -0
- data/lib/action_controller/test_case.rb +0 -1
- data/lib/action_dispatch/routing/mapper.rb +2 -1
- data/lib/action_dispatch/routing/redirection.rb +2 -0
- data/lib/action_dispatch/routing/route_set.rb +1 -2
- data/lib/action_pack/gem_version.rb +1 -1
- metadata +9 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c93df97ac0fce3460e53efeb18b02083ef0073c
|
4
|
+
data.tar.gz: fb461b8c58bc5f311a2675d4398d2cb522e570dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37d28060d94d2ed5ec3b2d41c484720e85eb537067d0fa0b194284b0059061602089bdc585ee285eb9f9f60e5e9a68d2cf1f9f64f443ddc26e77169fa1febfe4
|
7
|
+
data.tar.gz: 50c081cf18ef9702e72df949d5646fa8ed0e7b96943434b526981a37aed0ffef246fd11409990f69c1e6d202ff9972a4c79655524f5167f906a2a7a1b3fcf860
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,94 @@
|
|
1
|
+
* Raise exception when calling `to_h` in an unfiltered Parameters.
|
2
|
+
|
3
|
+
This method will raise on unfiltered Parameters if
|
4
|
+
`config.action_controller.raise_on_unfiltered_parameters` is true.
|
5
|
+
|
6
|
+
Before we returned either an empty hash or only the always permitted parameters
|
7
|
+
(`:controller` and `:action` by default).
|
8
|
+
|
9
|
+
The previous behavior was dangerous because in order to get the attributes users
|
10
|
+
usually fallback to use `to_unsafe_h` that could potentially introduce security issues.
|
11
|
+
|
12
|
+
*Rafael Mendonça França*
|
13
|
+
|
14
|
+
* Add `ActionController::Parameters#to_hash` to implicit conversion.
|
15
|
+
|
16
|
+
Now methods that implicit convert objects to a hash will be able to work without
|
17
|
+
requiring the users to change their implementation.
|
18
|
+
|
19
|
+
This method will return a `Hash` instead of a `ActiveSupport::HashWithIndefirentAccess`
|
20
|
+
to mimic the same implementation of `ActiveSupport::HashWithIndefirentAccess#to_hash`.
|
21
|
+
|
22
|
+
This method will raise on unfiltered Parameters if
|
23
|
+
`config.action_controller.raise_on_unfiltered_parameters` is true.
|
24
|
+
|
25
|
+
*Rafael Mendonça França*
|
26
|
+
|
27
|
+
* Undeprecate `ActionController::Parameters#to_query` and `#to_param`.
|
28
|
+
|
29
|
+
Previously it was raising a deprecation because it may be unsafe to use those methods
|
30
|
+
in an unfiltered parameter. Now we delegate to `#to_h` that already raise an error when
|
31
|
+
the Parameters instance is not permitted.
|
32
|
+
|
33
|
+
This also fix a bug when using `#to_query` in a hash that contains a
|
34
|
+
`ActionController::Parameters` instance and was returning the name of the class in the
|
35
|
+
string.
|
36
|
+
|
37
|
+
*Rafael Mendonça França*
|
38
|
+
|
39
|
+
* Use more specific check for :format in route path
|
40
|
+
|
41
|
+
The current check for whether to add an optional format to the path is very lax
|
42
|
+
and will match things like `:format_id` where there are nested resources, e.g:
|
43
|
+
|
44
|
+
``` ruby
|
45
|
+
resources :formats do
|
46
|
+
resources :items
|
47
|
+
end
|
48
|
+
```
|
49
|
+
|
50
|
+
Fix this by using a more restrictive regex pattern that looks for the patterns
|
51
|
+
`(.:format)`, `.:format` or `/` at the end of the path. Note that we need to
|
52
|
+
allow for multiple closing parenthesis since the route may be of this form:
|
53
|
+
|
54
|
+
``` ruby
|
55
|
+
get "/books(/:action(.:format))", controller: "books"
|
56
|
+
```
|
57
|
+
|
58
|
+
This probably isn't what's intended since it means that the default index action
|
59
|
+
route doesn't support a format but we have a test for it so we need to allow it.
|
60
|
+
|
61
|
+
Fixes #28517.
|
62
|
+
|
63
|
+
*Andrew White*
|
64
|
+
|
65
|
+
* Don't include default headers in `ActionController::Metal` responses
|
66
|
+
|
67
|
+
The commit e16afe6 introduced an unintentional change of behavior where the default
|
68
|
+
headers were included in responses from `ActionController::Metai` based controllers.
|
69
|
+
This is now reverted to the previous behavior of having no default headers.
|
70
|
+
|
71
|
+
Fixes #25820.
|
72
|
+
|
73
|
+
*Jon Moss*
|
74
|
+
|
75
|
+
* Fix malformed URLS when using `ApplicationController.renderer`
|
76
|
+
|
77
|
+
The Rack environment variable `rack.url_scheme` was not being set so `scheme` was
|
78
|
+
returning `nil`. This caused URLs to be malformed with the default settings.
|
79
|
+
Fix this by setting `rack.url_scheme` when the environment is normalized.
|
80
|
+
|
81
|
+
Fixes #28151.
|
82
|
+
|
83
|
+
*George Vrettos*
|
84
|
+
|
85
|
+
* Commit flash changes when using a redirect route.
|
86
|
+
|
87
|
+
Fixes #27992.
|
88
|
+
|
89
|
+
*Andrew White*
|
90
|
+
|
91
|
+
|
1
92
|
## Rails 5.0.2 (March 01, 2017) ##
|
2
93
|
|
3
94
|
* Make `with_routing` test helper work when testing controllers inheriting from `ActionController::API`.
|
@@ -260,6 +260,12 @@ module ActionController
|
|
260
260
|
PROTECTED_IVARS
|
261
261
|
end
|
262
262
|
|
263
|
+
def self.make_response!(request)
|
264
|
+
ActionDispatch::Response.create.tap do |res|
|
265
|
+
res.request = request
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
263
269
|
ActiveSupport.run_load_hooks(:action_controller, self)
|
264
270
|
end
|
265
271
|
end
|
@@ -43,6 +43,18 @@ module ActionController
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
+
# Raised when a Parameters instance is not marked as permitted and
|
47
|
+
# an operation to transform it to hash is called.
|
48
|
+
#
|
49
|
+
# params = ActionController::Parameters.new(a: "123", b: "456")
|
50
|
+
# params.to_h
|
51
|
+
# # => ActionController::UnfilteredParameters: unable to convert unpermitted parameters to hash
|
52
|
+
class UnfilteredParameters < ArgumentError
|
53
|
+
def initialize # :nodoc:
|
54
|
+
super("unable to convert unpermitted parameters to hash")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
46
58
|
# == Action Controller \Parameters
|
47
59
|
#
|
48
60
|
# Allows you to choose which attributes should be whitelisted for mass updating
|
@@ -53,9 +65,9 @@ module ActionController
|
|
53
65
|
#
|
54
66
|
# params = ActionController::Parameters.new({
|
55
67
|
# person: {
|
56
|
-
# name:
|
68
|
+
# name: "Francesco",
|
57
69
|
# age: 22,
|
58
|
-
# role:
|
70
|
+
# role: "admin"
|
59
71
|
# }
|
60
72
|
# })
|
61
73
|
#
|
@@ -103,13 +115,85 @@ module ActionController
|
|
103
115
|
# You can fetch values of <tt>ActionController::Parameters</tt> using either
|
104
116
|
# <tt>:key</tt> or <tt>"key"</tt>.
|
105
117
|
#
|
106
|
-
# params = ActionController::Parameters.new(key:
|
118
|
+
# params = ActionController::Parameters.new(key: "value")
|
107
119
|
# params[:key] # => "value"
|
108
120
|
# params["key"] # => "value"
|
109
121
|
class Parameters
|
110
122
|
cattr_accessor :permit_all_parameters, instance_accessor: false
|
111
123
|
cattr_accessor :action_on_unpermitted_parameters, instance_accessor: false
|
124
|
+
cattr_accessor :raise_on_unfiltered_parameters, instance_accessor: false
|
125
|
+
|
126
|
+
##
|
127
|
+
# :method: as_json
|
128
|
+
#
|
129
|
+
# :call-seq:
|
130
|
+
# as_json(options=nil)
|
131
|
+
#
|
132
|
+
# Returns a hash that can be used as the JSON representation for the params.
|
133
|
+
|
134
|
+
##
|
135
|
+
# :method: empty?
|
136
|
+
#
|
137
|
+
# :call-seq:
|
138
|
+
# empty?()
|
139
|
+
#
|
140
|
+
# Returns true if the object has no key/value pairs.
|
141
|
+
|
142
|
+
##
|
143
|
+
# :method: has_key?
|
144
|
+
#
|
145
|
+
# :call-seq:
|
146
|
+
# has_key?(key)
|
147
|
+
#
|
148
|
+
# Returns true if the given key is present in the parameters.
|
149
|
+
|
150
|
+
##
|
151
|
+
# :method: has_value?
|
152
|
+
#
|
153
|
+
# :call-seq:
|
154
|
+
# has_value?(value)
|
155
|
+
#
|
156
|
+
# Returns true if the given value is present for some key in the parameters.
|
157
|
+
|
158
|
+
##
|
159
|
+
# :method: include?
|
160
|
+
#
|
161
|
+
# :call-seq:
|
162
|
+
# include?(key)
|
163
|
+
#
|
164
|
+
# Returns true if the given key is present in the parameters.
|
165
|
+
|
166
|
+
##
|
167
|
+
# :method: key?
|
168
|
+
#
|
169
|
+
# :call-seq:
|
170
|
+
# key?(key)
|
171
|
+
#
|
172
|
+
# Returns true if the given key is present in the parameters.
|
112
173
|
|
174
|
+
##
|
175
|
+
# :method: keys
|
176
|
+
#
|
177
|
+
# :call-seq:
|
178
|
+
# keys()
|
179
|
+
#
|
180
|
+
# Returns a new array of the keys of the parameters.
|
181
|
+
|
182
|
+
##
|
183
|
+
# :method: value?
|
184
|
+
#
|
185
|
+
# :call-seq:
|
186
|
+
# value?(value)
|
187
|
+
#
|
188
|
+
# Returns true if the given value is present for some key in the parameters.
|
189
|
+
|
190
|
+
##
|
191
|
+
# :method: values
|
192
|
+
#
|
193
|
+
# :call-seq:
|
194
|
+
# values()
|
195
|
+
#
|
196
|
+
# Returns a new array of the values of the parameters.
|
113
197
|
delegate :keys, :key?, :has_key?, :values, :has_value?, :value?, :empty?, :include?,
|
114
198
|
:as_json, to: :@parameters
|
115
199
|
|
@@ -130,13 +214,13 @@ module ActionController
|
|
130
214
|
# class Person < ActiveRecord::Base
|
131
215
|
# end
|
132
216
|
#
|
133
|
-
# params = ActionController::Parameters.new(name:
|
217
|
+
# params = ActionController::Parameters.new(name: "Francesco")
|
134
218
|
# params.permitted? # => false
|
135
219
|
# Person.new(params) # => ActiveModel::ForbiddenAttributesError
|
136
220
|
#
|
137
221
|
# ActionController::Parameters.permit_all_parameters = true
|
138
222
|
#
|
139
|
-
# params = ActionController::Parameters.new(name:
|
223
|
+
# params = ActionController::Parameters.new(name: "Francesco")
|
140
224
|
# params.permitted? # => true
|
141
225
|
# Person.new(params) # => #<Person id: nil, name: "Francesco">
|
142
226
|
def initialize(parameters = {})
|
@@ -164,31 +248,93 @@ module ActionController
|
|
164
248
|
end
|
165
249
|
|
166
250
|
# Returns a safe <tt>ActiveSupport::HashWithIndifferentAccess</tt>
|
167
|
-
# representation of
|
251
|
+
# representation of the parameters with all unpermitted keys removed.
|
168
252
|
#
|
169
253
|
# params = ActionController::Parameters.new({
|
170
|
-
# name:
|
171
|
-
# oddity:
|
254
|
+
# name: "Senjougahara Hitagi",
|
255
|
+
# oddity: "Heavy stone crab"
|
172
256
|
# })
|
173
|
-
# params.to_h
|
257
|
+
# params.to_h
|
258
|
+
# # => ActionController::UnfilteredParameters: unable to convert unfiltered parameters to hash
|
174
259
|
#
|
175
260
|
# safe_params = params.permit(:name)
|
176
261
|
# safe_params.to_h # => {"name"=>"Senjougahara Hitagi"}
|
177
262
|
def to_h
|
178
263
|
if permitted?
|
179
264
|
convert_parameters_to_hashes(@parameters, :to_h)
|
265
|
+
elsif self.class.raise_on_unfiltered_parameters
|
266
|
+
raise UnfilteredParameters
|
180
267
|
else
|
181
268
|
slice(*self.class.always_permitted_parameters).permit!.to_h
|
182
269
|
end
|
183
270
|
end
|
184
271
|
|
272
|
+
# Returns a safe <tt>Hash</tt> representation of the parameters
|
273
|
+
# with all unpermitted keys removed.
|
274
|
+
#
|
275
|
+
# params = ActionController::Parameters.new({
|
276
|
+
# name: "Senjougahara Hitagi",
|
277
|
+
# oddity: "Heavy stone crab"
|
278
|
+
# })
|
279
|
+
# params.to_hash
|
280
|
+
# # => ActionController::UnfilteredParameters: unable to convert unfiltered parameters to hash
|
281
|
+
#
|
282
|
+
# safe_params = params.permit(:name)
|
283
|
+
# safe_params.to_hash # => {"name"=>"Senjougahara Hitagi"}
|
284
|
+
def to_hash
|
285
|
+
if self.class.raise_on_unfiltered_parameters
|
286
|
+
to_h.to_hash
|
287
|
+
else
|
288
|
+
message = <<-DEPRECATE.squish
|
289
|
+
#to_hash unexpectedly ignores parameter filtering, and will change to enforce it in Rails 5.1.
|
290
|
+
Enable `raise_on_unfiltered_parameters` to respect parameter filtering, which is the default
|
291
|
+
in new applications. For the existing deprecated behaviour, call #to_unsafe_h instead.
|
292
|
+
DEPRECATE
|
293
|
+
ActiveSupport::Deprecation.warn(message)
|
294
|
+
|
295
|
+
@parameters.to_hash
|
296
|
+
end
|
297
|
+
end
|
298
|
+
|
299
|
+
# Returns a string representation of the receiver suitable for use as a URL
|
300
|
+
# query string:
|
301
|
+
#
|
302
|
+
# params = ActionController::Parameters.new({
|
303
|
+
# name: "David",
|
304
|
+
# nationality: "Danish"
|
305
|
+
# })
|
306
|
+
# params.to_query
|
307
|
+
# # => "name=David&nationality=Danish"
|
308
|
+
#
|
309
|
+
# An optional namespace can be passed to enclose key names:
|
310
|
+
#
|
311
|
+
# params = ActionController::Parameters.new({
|
312
|
+
# name: "David",
|
313
|
+
# nationality: "Danish"
|
314
|
+
# })
|
315
|
+
# params.to_query("user")
|
316
|
+
# # => "user%5Bname%5D=David&user%5Bnationality%5D=Danish"
|
317
|
+
#
|
318
|
+
# The string pairs "key=value" that conform the query string
|
319
|
+
# are sorted lexicographically in ascending order.
|
320
|
+
#
|
321
|
+
# This method is also aliased as +to_param+.
|
322
|
+
def to_query(*args)
|
323
|
+
if self.class.raise_on_unfiltered_parameters
|
324
|
+
to_h.to_query(*args)
|
325
|
+
else
|
326
|
+
@parameters.to_query(*args)
|
327
|
+
end
|
328
|
+
end
|
329
|
+
alias_method :to_param, :to_query
|
330
|
+
|
185
331
|
# Returns an unsafe, unfiltered
|
186
|
-
# <tt>ActiveSupport::HashWithIndifferentAccess</tt> representation of
|
187
|
-
#
|
332
|
+
# <tt>ActiveSupport::HashWithIndifferentAccess</tt> representation of the
|
333
|
+
# parameters.
|
188
334
|
#
|
189
335
|
# params = ActionController::Parameters.new({
|
190
|
-
# name:
|
191
|
-
# oddity:
|
336
|
+
# name: "Senjougahara Hitagi",
|
337
|
+
# oddity: "Heavy stone crab"
|
192
338
|
# })
|
193
339
|
# params.to_unsafe_h
|
194
340
|
# # => {"name"=>"Senjougahara Hitagi", "oddity" => "Heavy stone crab"}
|
@@ -233,7 +379,7 @@ module ActionController
|
|
233
379
|
# class Person < ActiveRecord::Base
|
234
380
|
# end
|
235
381
|
#
|
236
|
-
# params = ActionController::Parameters.new(name:
|
382
|
+
# params = ActionController::Parameters.new(name: "Francesco")
|
237
383
|
# params.permitted? # => false
|
238
384
|
# Person.new(params) # => ActiveModel::ForbiddenAttributesError
|
239
385
|
# params.permit!
|
@@ -255,7 +401,7 @@ module ActionController
|
|
255
401
|
# When passed a single key, if it exists and its associated value is
|
256
402
|
# either present or the singleton +false+, returns said value:
|
257
403
|
#
|
258
|
-
# ActionController::Parameters.new(person: { name:
|
404
|
+
# ActionController::Parameters.new(person: { name: "Francesco" }).require(:person)
|
259
405
|
# # => <ActionController::Parameters {"name"=>"Francesco"} permitted: false>
|
260
406
|
#
|
261
407
|
# Otherwise raises <tt>ActionController::ParameterMissing</tt>:
|
@@ -288,7 +434,7 @@ module ActionController
|
|
288
434
|
# Technically this method can be used to fetch terminal values:
|
289
435
|
#
|
290
436
|
# # CAREFUL
|
291
|
-
# params = ActionController::Parameters.new(person: { name:
|
437
|
+
# params = ActionController::Parameters.new(person: { name: "Finn" })
|
292
438
|
# name = params.require(:person).require(:name) # CAREFUL
|
293
439
|
#
|
294
440
|
# but take into account that at some point those ones have to be permitted:
|
@@ -318,7 +464,7 @@ module ActionController
|
|
318
464
|
# for the object to +true+. This is useful for limiting which attributes
|
319
465
|
# should be allowed for mass updating.
|
320
466
|
#
|
321
|
-
# params = ActionController::Parameters.new(user: { name:
|
467
|
+
# params = ActionController::Parameters.new(user: { name: "Francesco", age: 22, role: "admin" })
|
322
468
|
# permitted = params.require(:user).permit(:name, :age)
|
323
469
|
# permitted.permitted? # => true
|
324
470
|
# permitted.has_key?(:name) # => true
|
@@ -338,18 +484,18 @@ module ActionController
|
|
338
484
|
# You may declare that the parameter should be an array of permitted scalars
|
339
485
|
# by mapping it to an empty array:
|
340
486
|
#
|
341
|
-
# params = ActionController::Parameters.new(tags: [
|
487
|
+
# params = ActionController::Parameters.new(tags: ["rails", "parameters"])
|
342
488
|
# params.permit(tags: [])
|
343
489
|
#
|
344
490
|
# You can also use +permit+ on nested parameters, like:
|
345
491
|
#
|
346
492
|
# params = ActionController::Parameters.new({
|
347
493
|
# person: {
|
348
|
-
# name:
|
494
|
+
# name: "Francesco",
|
349
495
|
# age: 22,
|
350
496
|
# pets: [{
|
351
|
-
# name:
|
352
|
-
# category:
|
497
|
+
# name: "Purplish",
|
498
|
+
# category: "dogs"
|
353
499
|
# }]
|
354
500
|
# }
|
355
501
|
# })
|
@@ -368,8 +514,8 @@ module ActionController
|
|
368
514
|
# params = ActionController::Parameters.new({
|
369
515
|
# person: {
|
370
516
|
# contact: {
|
371
|
-
# email:
|
372
|
-
# phone:
|
517
|
+
# email: "none@test.com",
|
518
|
+
# phone: "555-1234"
|
373
519
|
# }
|
374
520
|
# }
|
375
521
|
# })
|
@@ -402,7 +548,7 @@ module ActionController
|
|
402
548
|
# Returns a parameter for the given +key+. If not found,
|
403
549
|
# returns +nil+.
|
404
550
|
#
|
405
|
-
# params = ActionController::Parameters.new(person: { name:
|
551
|
+
# params = ActionController::Parameters.new(person: { name: "Francesco" })
|
406
552
|
# params[:person] # => <ActionController::Parameters {"name"=>"Francesco"} permitted: false>
|
407
553
|
# params[:none] # => nil
|
408
554
|
def [](key)
|
@@ -421,11 +567,11 @@ module ActionController
|
|
421
567
|
# if more arguments are given, then that will be returned; if a block
|
422
568
|
# is given, then that will be run and its result returned.
|
423
569
|
#
|
424
|
-
# params = ActionController::Parameters.new(person: { name:
|
570
|
+
# params = ActionController::Parameters.new(person: { name: "Francesco" })
|
425
571
|
# params.fetch(:person) # => <ActionController::Parameters {"name"=>"Francesco"} permitted: false>
|
426
572
|
# params.fetch(:none) # => ActionController::ParameterMissing: param is missing or the value is empty: none
|
427
|
-
# params.fetch(:none,
|
428
|
-
# params.fetch(:none) {
|
573
|
+
# params.fetch(:none, "Francesco") # => "Francesco"
|
574
|
+
# params.fetch(:none) { "Francesco" } # => "Francesco"
|
429
575
|
def fetch(key, *args)
|
430
576
|
convert_value_to_parameters(
|
431
577
|
@parameters.fetch(key) {
|
@@ -536,8 +682,8 @@ module ActionController
|
|
536
682
|
# to key. If the key is not found, returns the default value. If the
|
537
683
|
# optional code block is given and the key is not found, pass in the key
|
538
684
|
# and return the result of block.
|
539
|
-
def delete(key)
|
540
|
-
convert_value_to_parameters(@parameters.delete(key))
|
685
|
+
def delete(key, &block)
|
686
|
+
convert_value_to_parameters(@parameters.delete(key, &block))
|
541
687
|
end
|
542
688
|
|
543
689
|
# Returns a new instance of <tt>ActionController::Parameters</tt> with only
|
@@ -625,10 +771,6 @@ module ActionController
|
|
625
771
|
end
|
626
772
|
end
|
627
773
|
|
628
|
-
# Undefine `to_param` such that it gets caught in the `method_missing`
|
629
|
-
# deprecation cycle below.
|
630
|
-
undef_method :to_param
|
631
|
-
|
632
774
|
def method_missing(method_sym, *args, &block)
|
633
775
|
if @parameters.respond_to?(method_sym)
|
634
776
|
message = <<-DEPRECATE.squish
|
@@ -647,7 +789,11 @@ module ActionController
|
|
647
789
|
end
|
648
790
|
end
|
649
791
|
|
650
|
-
|
792
|
+
def respond_to?(name, include_all = false) # :nodoc:
|
793
|
+
super || @parameters.respond_to?(name, include_all)
|
794
|
+
end
|
795
|
+
|
796
|
+
# Returns duplicate of object including all parameters.
|
651
797
|
def deep_dup
|
652
798
|
self.class.new(@parameters.deep_dup).tap do |duplicate|
|
653
799
|
duplicate.permitted = @permitted
|
@@ -27,6 +27,7 @@ module ActionController
|
|
27
27
|
ActionController::Parameters.always_permitted_parameters =
|
28
28
|
app.config.action_controller.delete(:always_permitted_parameters)
|
29
29
|
end
|
30
|
+
ActionController::Parameters.raise_on_unfiltered_parameters = options.delete(:raise_on_unfiltered_parameters) { false }
|
30
31
|
ActionController::Parameters.action_on_unpermitted_parameters = options.delete(:action_on_unpermitted_parameters) do
|
31
32
|
(Rails.env.test? || Rails.env.development?) ? :log : false
|
32
33
|
end
|
@@ -54,6 +54,7 @@ module ActionDispatch
|
|
54
54
|
|
55
55
|
class Mapping #:nodoc:
|
56
56
|
ANCHOR_CHARACTERS_REGEX = %r{\A(\\A|\^)|(\\Z|\\z|\$)\Z}
|
57
|
+
OPTIONAL_FORMAT_REGEX = %r{(?:\(\.:format\)+|\.:format|/)\Z}
|
57
58
|
|
58
59
|
attr_reader :requirements, :defaults
|
59
60
|
attr_reader :to, :default_controller, :default_action
|
@@ -93,7 +94,7 @@ module ActionDispatch
|
|
93
94
|
end
|
94
95
|
|
95
96
|
def self.optional_format?(path, format)
|
96
|
-
format != false &&
|
97
|
+
format != false && path !~ OPTIONAL_FORMAT_REGEX
|
97
98
|
end
|
98
99
|
|
99
100
|
def initialize(set, ast, defaults, controller, default_action, modyoule, to, formatted, scope_constraints, blocks, via, options_constraints, anchor, options)
|
@@ -36,6 +36,8 @@ module ActionDispatch
|
|
36
36
|
uri.host ||= req.host
|
37
37
|
uri.port ||= req.port unless req.standard_port?
|
38
38
|
|
39
|
+
req.commit_flash
|
40
|
+
|
39
41
|
body = %(<html><body>You are being <a href="#{ERB::Util.unwrapped_html_escape(uri.to_s)}">redirected</a>.</body></html>)
|
40
42
|
|
41
43
|
headers = {
|
@@ -745,8 +745,7 @@ module ActionDispatch
|
|
745
745
|
params[key] = URI.parser.unescape(value)
|
746
746
|
end
|
747
747
|
end
|
748
|
-
|
749
|
-
req.path_parameters = old_params.merge params
|
748
|
+
req.path_parameters = params
|
750
749
|
app = route.app
|
751
750
|
if app.matches?(req) && app.dispatcher?
|
752
751
|
begin
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: actionpack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 5.0.
|
19
|
+
version: 5.0.3
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 5.0.
|
26
|
+
version: 5.0.3
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rack
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -92,28 +92,28 @@ dependencies:
|
|
92
92
|
requirements:
|
93
93
|
- - '='
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: 5.0.
|
95
|
+
version: 5.0.3
|
96
96
|
type: :runtime
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
100
|
- - '='
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: 5.0.
|
102
|
+
version: 5.0.3
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: activemodel
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
107
|
- - '='
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: 5.0.
|
109
|
+
version: 5.0.3
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
114
|
- - '='
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version: 5.0.
|
116
|
+
version: 5.0.3
|
117
117
|
description: Web apps on Rails. Simple, battle-tested conventions for building and
|
118
118
|
testing MVC web applications. Works with any Rack-compatible server.
|
119
119
|
email: david@loudthinking.com
|
@@ -303,3 +303,4 @@ signing_key:
|
|
303
303
|
specification_version: 4
|
304
304
|
summary: Web-flow and rendering framework putting the VC in MVC (part of Rails).
|
305
305
|
test_files: []
|
306
|
+
has_rdoc:
|