actionpack 5.1.3 → 5.1.4.rc1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d13e5cd272e7e5ea64f9a5fb683d0e93fbf67b7f
4
- data.tar.gz: a831d402ff1f455a7a226117a8f823dcf61ee083
3
+ metadata.gz: f4f8ad00d3fae78fec762b134cda31adef2b2691
4
+ data.tar.gz: 42ca1f1ed7e1af5d650a53689bc780da77d167b5
5
5
  SHA512:
6
- metadata.gz: ab83e620d463aba5bcf9f18646dcee8655dcb2920fde3cb7e228d8e5aea7aa30378ed3bbbd573226c09fee71c235d275c20c4ed3bec40caf5ffe4a959cbaf7ec
7
- data.tar.gz: 8a65ea0b12a729e5f4c0d40f10d5f6cc4cbd22d220548f2809d53fbb22bc2fd146b02cfd01fb8de8dd9970837137ffb6f0a31f546e8210110a666c721fc0d255
6
+ metadata.gz: c2840a0d64ffb582932c09cd3ce1290f426a168149de1489789f12cd74c0993e99b82556bd4c05a1b047d5662801d57ffb399bd19fd792f827628fbeb4e7c547
7
+ data.tar.gz: bc4f58ffc37b521110b58934de8abb00badc1f2598fed16a19e1d175e6bc00fb7b5b919f329240864ad6fe1c4f6269a1a3ba796912bd85378363f625e3203820
@@ -1,3 +1,8 @@
1
+ ## Rails 5.1.4.rc1 (August 24, 2017) ##
2
+
3
+ * No changes.
4
+
5
+
1
6
  ## Rails 5.1.3 (August 03, 2017) ##
2
7
 
3
8
  * No changes.
@@ -22,17 +22,19 @@ module ActionController
22
22
  initializer "action_controller.parameters_config" do |app|
23
23
  options = app.config.action_controller
24
24
 
25
- if options.delete(:raise_on_unfiltered_parameters)
26
- ActiveSupport::Deprecation.warn("raise_on_unfiltered_parameters is deprecated and has no effect in Rails 5.1.")
27
- end
25
+ ActiveSupport.on_load(:action_controller, run_once: true) do
26
+ if options.delete(:raise_on_unfiltered_parameters)
27
+ ActiveSupport::Deprecation.warn("raise_on_unfiltered_parameters is deprecated and has no effect in Rails 5.1.")
28
+ end
28
29
 
29
- ActionController::Parameters.permit_all_parameters = options.delete(:permit_all_parameters) { false }
30
- if app.config.action_controller[:always_permitted_parameters]
31
- ActionController::Parameters.always_permitted_parameters =
32
- app.config.action_controller.delete(:always_permitted_parameters)
33
- end
34
- ActionController::Parameters.action_on_unpermitted_parameters = options.delete(:action_on_unpermitted_parameters) do
35
- (Rails.env.test? || Rails.env.development?) ? :log : false
30
+ ActionController::Parameters.permit_all_parameters = options.delete(:permit_all_parameters) { false }
31
+ if app.config.action_controller[:always_permitted_parameters]
32
+ ActionController::Parameters.always_permitted_parameters =
33
+ app.config.action_controller.delete(:always_permitted_parameters)
34
+ end
35
+ ActionController::Parameters.action_on_unpermitted_parameters = options.delete(:action_on_unpermitted_parameters) do
36
+ (Rails.env.test? || Rails.env.development?) ? :log : false
37
+ end
36
38
  end
37
39
  end
38
40
 
@@ -55,7 +55,7 @@ module ActionDispatch
55
55
  query_parameters.dup
56
56
  end
57
57
  params.merge!(path_parameters)
58
- params = set_binary_encoding(params)
58
+ params = set_binary_encoding(params, params[:controller], params[:action])
59
59
  set_header("action_dispatch.request.parameters", params)
60
60
  params
61
61
  end
@@ -64,6 +64,7 @@ module ActionDispatch
64
64
  def path_parameters=(parameters) #:nodoc:
65
65
  delete_header("action_dispatch.request.parameters")
66
66
 
67
+ parameters = set_binary_encoding(parameters, parameters[:controller], parameters[:action])
67
68
  # If any of the path parameters has an invalid encoding then
68
69
  # raise since it's likely to trigger errors further on.
69
70
  Request::Utils.check_param_encoding(parameters)
@@ -83,9 +84,10 @@ module ActionDispatch
83
84
 
84
85
  private
85
86
 
86
- def set_binary_encoding(params)
87
- action = params[:action]
88
- if binary_params_for?(action)
87
+ def set_binary_encoding(params, controller, action)
88
+ return params unless controller && controller.valid_encoding?
89
+
90
+ if binary_params_for?(controller, action)
89
91
  ActionDispatch::Request::Utils.each_param_value(params) do |param|
90
92
  param.force_encoding ::Encoding::ASCII_8BIT
91
93
  end
@@ -93,8 +95,8 @@ module ActionDispatch
93
95
  params
94
96
  end
95
97
 
96
- def binary_params_for?(action)
97
- controller_class.binary_params_for?(action)
98
+ def binary_params_for?(controller, action)
99
+ controller_class_for(controller).binary_params_for?(action)
98
100
  rescue NameError
99
101
  false
100
102
  end
@@ -74,10 +74,13 @@ module ActionDispatch
74
74
 
75
75
  def controller_class
76
76
  params = path_parameters
77
+ params[:action] ||= "index"
78
+ controller_class_for(params[:controller])
79
+ end
77
80
 
78
- if params.key?(:controller)
79
- controller_param = params[:controller].underscore
80
- params[:action] ||= "index"
81
+ def controller_class_for(name)
82
+ if name
83
+ controller_param = name.underscore
81
84
  const_name = "#{controller_param.camelize}Controller"
82
85
  ActiveSupport::Dependencies.constantize(const_name)
83
86
  else
@@ -41,6 +41,10 @@ module ActionDispatch
41
41
  req.path_info = "/" + req.path_info unless req.path_info.start_with? "/"
42
42
  end
43
43
 
44
+ parameters = route.defaults.merge parameters.transform_values { |val|
45
+ val.dup.force_encoding(::Encoding::UTF_8)
46
+ }
47
+
44
48
  req.path_parameters = set_params.merge parameters
45
49
 
46
50
  status, headers, body = route.app.serve(req)
@@ -65,6 +69,7 @@ module ActionDispatch
65
69
  rails_req.path_info = match.post_match.sub(/^([^\/])/, '/\1')
66
70
  end
67
71
 
72
+ parameters = route.defaults.merge parameters
68
73
  yield(route, parameters)
69
74
  end
70
75
  end
@@ -117,7 +122,7 @@ module ActionDispatch
117
122
 
118
123
  routes.map! { |r|
119
124
  match_data = r.path.match(req.path_info)
120
- path_parameters = r.defaults.dup
125
+ path_parameters = {}
121
126
  match_data.names.zip(match_data.captures) { |name, val|
122
127
  path_parameters[name.to_sym] = Utils.unescape_uri(val) if val
123
128
  }
@@ -13,11 +13,13 @@ module ActionDispatch
13
13
  # normalize_path("") # => "/"
14
14
  # normalize_path("/%ab") # => "/%AB"
15
15
  def self.normalize_path(path)
16
+ encoding = path.encoding
16
17
  path = "/#{path}"
17
18
  path.squeeze!("/".freeze)
18
19
  path.sub!(%r{/+\Z}, "".freeze)
19
20
  path.gsub!(/(%[a-f0-9]{2})/) { $1.upcase }
20
21
  path = "/" if path == "".freeze
22
+ path.force_encoding(encoding)
21
23
  path
22
24
  end
23
25
 
@@ -3,6 +3,12 @@ require "rack/handler/puma"
3
3
  module ActionDispatch
4
4
  module SystemTesting
5
5
  class Server # :nodoc:
6
+ class << self
7
+ attr_accessor :silence_puma
8
+ end
9
+
10
+ self.silence_puma = false
11
+
6
12
  def run
7
13
  register
8
14
  setup
@@ -11,7 +17,12 @@ module ActionDispatch
11
17
  private
12
18
  def register
13
19
  Capybara.register_server :rails_puma do |app, port, host|
14
- Rack::Handler::Puma.run(app, Port: port, Threads: "0:1")
20
+ Rack::Handler::Puma.run(
21
+ app,
22
+ Port: port,
23
+ Threads: "0:1",
24
+ Silent: self.class.silence_puma
25
+ )
15
26
  end
16
27
  end
17
28
 
@@ -7,8 +7,8 @@ module ActionPack
7
7
  module VERSION
8
8
  MAJOR = 5
9
9
  MINOR = 1
10
- TINY = 3
11
- PRE = nil
10
+ TINY = 4
11
+ PRE = "rc1"
12
12
 
13
13
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
14
14
  end
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.1.3
4
+ version: 5.1.4.rc1
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-08-03 00:00:00.000000000 Z
11
+ date: 2017-08-24 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.1.3
19
+ version: 5.1.4.rc1
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.1.3
26
+ version: 5.1.4.rc1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rack
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -42,14 +42,14 @@ dependencies:
42
42
  name: rack-test
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: 0.6.3
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.6.3
55
55
  - !ruby/object:Gem::Dependency
@@ -92,28 +92,28 @@ dependencies:
92
92
  requirements:
93
93
  - - '='
94
94
  - !ruby/object:Gem::Version
95
- version: 5.1.3
95
+ version: 5.1.4.rc1
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.1.3
102
+ version: 5.1.4.rc1
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.1.3
109
+ version: 5.1.4.rc1
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.1.3
116
+ version: 5.1.4.rc1
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
@@ -298,9 +298,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
298
298
  version: 2.2.2
299
299
  required_rubygems_version: !ruby/object:Gem::Requirement
300
300
  requirements:
301
- - - ">="
301
+ - - ">"
302
302
  - !ruby/object:Gem::Version
303
- version: '0'
303
+ version: 1.3.1
304
304
  requirements:
305
305
  - none
306
306
  rubyforge_project: