actionview 5.2.0 → 5.2.1.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of actionview might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3b9bca3ad68f9bc3d853d9e8636dfa45b622dfb7057699d0cf8de5612a06ced8
4
- data.tar.gz: 211e0f85de519e23139bf2f5916074e126162848173f4a4d9d2f1834d5e5152e
3
+ metadata.gz: 55f74f32f00c1013557003930c9c40d054853b8c92516340e0e66d4fed97c5ff
4
+ data.tar.gz: 3750a6d98a3ef56f1b571315c310d82cdde1f783916495bb75fc06429386f375
5
5
  SHA512:
6
- metadata.gz: 4ad77f4d4cf93c6f6c98c0892c43bbd5c161b2cda9f914b1f36116ba652ea8c940e56062c417bcb113025afa729b66b333340325ba86d686c5e5d696456deba2
7
- data.tar.gz: ecb595850c8eeb7b994067d90f9b30b6110472a895ba21f791adf10648eae7dc261d1d5849baaf0f07471783afa14e6258dd6234ec98b45b9762afe88bbc3f92
6
+ metadata.gz: 04765a001f6129f346fe59c40db24239f045d4b41589e921df44641bc8757025f03b43e354d72435e53d18e86fe9f6e36ecc571fbeb0eec082ab1b1f97a5449f
7
+ data.tar.gz: 437d254f31bdec09ad32c8798c28d0ddb5d94be9b42bec46d9c480b0b2b0375bf07be488719d497fa6381f94b6ab4f392f7ce5fb1e701168faf486ea121dc03e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,35 @@
1
+ ## Rails 5.2.1.rc1 (July 30, 2018) ##
2
+
3
+ * Fix leak of `skip_default_ids` and `allow_method_names_outside_object` options
4
+ to HTML attributes.
5
+
6
+ *Yurii Cherniavskyi*
7
+
8
+ * Fix issue with `button_to`'s `to_form_params`
9
+
10
+ `button_to` was throwing exception when invoked with `params` hash that
11
+ contains symbol and string keys. The reason for the exception was that
12
+ `to_form_params` was comparing the given symbol and string keys.
13
+
14
+ The issue is fixed by turning all keys to strings inside
15
+ `to_form_params` before comparing them.
16
+
17
+ *Georgi Georgiev*
18
+
19
+ * Fix JavaScript views rendering does not work with Firefox when using
20
+ Content Security Policy.
21
+
22
+ Fixes #32577.
23
+
24
+ *Yuji Yaginuma*
25
+
26
+ * Add the `nonce: true` option for `javascript_include_tag` helper to
27
+ support automatic nonce generation for Content Security Policy.
28
+ Works the same way as `javascript_tag nonce: true` does.
29
+
30
+ *Yaroslav Markin*
31
+
32
+
1
33
  ## Rails 5.2.0 (April 09, 2018) ##
2
34
 
3
35
  * Pass the `:skip_pipeline` option in `image_submit_tag` when calling `path_to_image`.
@@ -45,9 +45,8 @@ module ActionView
45
45
  # Create a dependency tree for template named +name+.
46
46
  def tree(name, finder, partial = false, seen = {})
47
47
  logical_name = name.gsub(%r|/_|, "/")
48
- finder.formats = [finder.rendered_format] if finder.rendered_format
49
48
 
50
- if template = finder.disable_cache { finder.find_all(logical_name, [], partial, []).first }
49
+ if template = find_template(finder, logical_name, [], partial, [])
51
50
  finder.rendered_format ||= template.formats.first
52
51
 
53
52
  if node = seen[template.identifier] # handle cycles in the tree
@@ -69,6 +68,17 @@ module ActionView
69
68
  seen[name] ||= Missing.new(name, logical_name, nil)
70
69
  end
71
70
  end
71
+
72
+ private
73
+ def find_template(finder, *args)
74
+ finder.disable_cache do
75
+ if format = finder.rendered_format
76
+ finder.find_all(*args, formats: [format]).first || finder.find_all(*args).first
77
+ else
78
+ finder.find_all(*args).first
79
+ end
80
+ end
81
+ end
72
82
  end
73
83
 
74
84
  class Node
@@ -9,8 +9,8 @@ module ActionView
9
9
  module VERSION
10
10
  MAJOR = 5
11
11
  MINOR = 2
12
- TINY = 0
13
- PRE = nil
12
+ TINY = 1
13
+ PRE = "rc1"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -55,6 +55,8 @@ module ActionView
55
55
  # that path.
56
56
  # * <tt>:skip_pipeline</tt> - This option is used to bypass the asset pipeline
57
57
  # when it is set to true.
58
+ # * <tt>:nonce<tt> - When set to true, adds an automatic nonce value if
59
+ # you have Content Security Policy enabled.
58
60
  #
59
61
  # ==== Examples
60
62
  #
@@ -79,6 +81,9 @@ module ActionView
79
81
  #
80
82
  # javascript_include_tag "http://www.example.com/xmlhr.js"
81
83
  # # => <script src="http://www.example.com/xmlhr.js"></script>
84
+ #
85
+ # javascript_include_tag "http://www.example.com/xmlhr.js", nonce: true
86
+ # # => <script src="http://www.example.com/xmlhr.js" nonce="..."></script>
82
87
  def javascript_include_tag(*sources)
83
88
  options = sources.extract_options!.stringify_keys
84
89
  path_options = options.extract!("protocol", "extname", "host", "skip_pipeline").symbolize_keys
@@ -90,6 +95,9 @@ module ActionView
90
95
  tag_options = {
91
96
  "src" => href
92
97
  }.merge!(options)
98
+ if tag_options["nonce"] == true
99
+ tag_options["nonce"] = content_security_policy_nonce
100
+ end
93
101
  content_tag("script".freeze, "", tag_options)
94
102
  }.join("\n").html_safe
95
103
 
@@ -105,7 +113,7 @@ module ActionView
105
113
  # to "screen", so you must explicitly set it to "all" for the stylesheet(s) to
106
114
  # apply to all media types.
107
115
  #
108
- # If the server supports Early Hints header links for these assets will be
116
+ # If the server supports Early Hints header links for these assets will be
109
117
  # automatically pushed.
110
118
  #
111
119
  # stylesheet_link_tag "style"
@@ -1658,6 +1658,7 @@ module ActionView
1658
1658
  @nested_child_index = {}
1659
1659
  @object_name, @object, @template, @options = object_name, object, template, options
1660
1660
  @default_options = @options ? @options.slice(:index, :namespace, :skip_default_ids, :allow_method_names_outside_object) : {}
1661
+ @default_html_options = @default_options.except(:skip_default_ids, :allow_method_names_outside_object)
1661
1662
 
1662
1663
  convert_to_legacy_options(@options)
1663
1664
 
@@ -820,7 +820,7 @@ module ActionView
820
820
  #
821
821
  # Please refer to the documentation of the base helper for details.
822
822
  def select(method, choices = nil, options = {}, html_options = {}, &block)
823
- @template.select(@object_name, method, choices, objectify_options(options), @default_options.merge(html_options), &block)
823
+ @template.select(@object_name, method, choices, objectify_options(options), @default_html_options.merge(html_options), &block)
824
824
  end
825
825
 
826
826
  # Wraps ActionView::Helpers::FormOptionsHelper#collection_select for form builders:
@@ -832,7 +832,7 @@ module ActionView
832
832
  #
833
833
  # Please refer to the documentation of the base helper for details.
834
834
  def collection_select(method, collection, value_method, text_method, options = {}, html_options = {})
835
- @template.collection_select(@object_name, method, collection, value_method, text_method, objectify_options(options), @default_options.merge(html_options))
835
+ @template.collection_select(@object_name, method, collection, value_method, text_method, objectify_options(options), @default_html_options.merge(html_options))
836
836
  end
837
837
 
838
838
  # Wraps ActionView::Helpers::FormOptionsHelper#grouped_collection_select for form builders:
@@ -844,7 +844,7 @@ module ActionView
844
844
  #
845
845
  # Please refer to the documentation of the base helper for details.
846
846
  def grouped_collection_select(method, collection, group_method, group_label_method, option_key_method, option_value_method, options = {}, html_options = {})
847
- @template.grouped_collection_select(@object_name, method, collection, group_method, group_label_method, option_key_method, option_value_method, objectify_options(options), @default_options.merge(html_options))
847
+ @template.grouped_collection_select(@object_name, method, collection, group_method, group_label_method, option_key_method, option_value_method, objectify_options(options), @default_html_options.merge(html_options))
848
848
  end
849
849
 
850
850
  # Wraps ActionView::Helpers::FormOptionsHelper#time_zone_select for form builders:
@@ -856,7 +856,7 @@ module ActionView
856
856
  #
857
857
  # Please refer to the documentation of the base helper for details.
858
858
  def time_zone_select(method, priority_zones = nil, options = {}, html_options = {})
859
- @template.time_zone_select(@object_name, method, priority_zones, objectify_options(options), @default_options.merge(html_options))
859
+ @template.time_zone_select(@object_name, method, priority_zones, objectify_options(options), @default_html_options.merge(html_options))
860
860
  end
861
861
 
862
862
  # Wraps ActionView::Helpers::FormOptionsHelper#collection_check_boxes for form builders:
@@ -868,7 +868,7 @@ module ActionView
868
868
  #
869
869
  # Please refer to the documentation of the base helper for details.
870
870
  def collection_check_boxes(method, collection, value_method, text_method, options = {}, html_options = {}, &block)
871
- @template.collection_check_boxes(@object_name, method, collection, value_method, text_method, objectify_options(options), @default_options.merge(html_options), &block)
871
+ @template.collection_check_boxes(@object_name, method, collection, value_method, text_method, objectify_options(options), @default_html_options.merge(html_options), &block)
872
872
  end
873
873
 
874
874
  # Wraps ActionView::Helpers::FormOptionsHelper#collection_radio_buttons for form builders:
@@ -880,7 +880,7 @@ module ActionView
880
880
  #
881
881
  # Please refer to the documentation of the base helper for details.
882
882
  def collection_radio_buttons(method, collection, value_method, text_method, options = {}, html_options = {}, &block)
883
- @template.collection_radio_buttons(@object_name, method, collection, value_method, text_method, objectify_options(options), @default_options.merge(html_options), &block)
883
+ @template.collection_radio_buttons(@object_name, method, collection, value_method, text_method, objectify_options(options), @default_html_options.merge(html_options), &block)
884
884
  end
885
885
  end
886
886
  end
@@ -13,7 +13,6 @@ module ActionView
13
13
  # * <tt>:partial</tt> - See <tt>ActionView::PartialRenderer</tt>.
14
14
  # * <tt>:file</tt> - Renders an explicit template file (this used to be the old default), add :locals to pass in those.
15
15
  # * <tt>:inline</tt> - Renders an inline template similar to how it's done in the controller.
16
- # * <tt>:text</tt> - Renders the text passed in out.
17
16
  # * <tt>:plain</tt> - Renders the text passed in out. Setting the content
18
17
  # type as <tt>text/plain</tt>.
19
18
  # * <tt>:html</tt> - Renders the HTML safe string passed in out, otherwise
@@ -8,7 +8,7 @@ module ActionView
8
8
  @choices = block_given? ? template_object.capture { yield || "" } : choices
9
9
  @choices = @choices.to_a if @choices.is_a?(Range)
10
10
 
11
- @html_options = html_options.except(:skip_default_ids, :allow_method_names_outside_object)
11
+ @html_options = html_options
12
12
 
13
13
  super(object_name, method_name, template_object, options)
14
14
  end
@@ -634,7 +634,7 @@ module ActionView
634
634
  # suitable for use as the names and values of form input fields:
635
635
  #
636
636
  # to_form_params(name: 'David', nationality: 'Danish')
637
- # # => [{name: :name, value: 'David'}, {name: 'nationality', value: 'Danish'}]
637
+ # # => [{name: 'name', value: 'David'}, {name: 'nationality', value: 'Danish'}]
638
638
  #
639
639
  # to_form_params(country: {name: 'Denmark'})
640
640
  # # => [{name: 'country[name]', value: 'Denmark'}]
@@ -666,7 +666,7 @@ module ActionView
666
666
  params.push(*to_form_params(value, array_prefix))
667
667
  end
668
668
  else
669
- params << { name: namespace, value: attribute.to_param }
669
+ params << { name: namespace.to_s, value: attribute.to_param }
670
670
  end
671
671
 
672
672
  params.sort_by { |pair| pair[:name] }
@@ -262,7 +262,7 @@ Released under the MIT license
262
262
  } catch (error) {}
263
263
  } else if (type.match(/\b(?:java|ecma)script\b/)) {
264
264
  script = document.createElement('script');
265
- script.nonce = cspNonce();
265
+ script.setAttribute('nonce', cspNonce());
266
266
  script.text = response;
267
267
  document.head.appendChild(script).parentNode.removeChild(script);
268
268
  } else if (type.match(/\b(xml|html|svg)\b/)) {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionview
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.0
4
+ version: 5.2.1.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: 2018-04-09 00:00:00.000000000 Z
11
+ date: 2018-07-30 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.2.0
19
+ version: 5.2.1.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.2.0
26
+ version: 5.2.1.rc1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: builder
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.2.0
95
+ version: 5.2.1.rc1
96
96
  type: :development
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.2.0
102
+ version: 5.2.1.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.2.0
109
+ version: 5.2.1.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.2.0
116
+ version: 5.2.1.rc1
117
117
  description: Simple, battle-tested conventions and helpers for building web pages.
118
118
  email: david@loudthinking.com
119
119
  executables: []
@@ -230,8 +230,8 @@ homepage: http://rubyonrails.org
230
230
  licenses:
231
231
  - MIT
232
232
  metadata:
233
- source_code_uri: https://github.com/rails/rails/tree/v5.2.0/actionview
234
- changelog_uri: https://github.com/rails/rails/blob/v5.2.0/actionview/CHANGELOG.md
233
+ source_code_uri: https://github.com/rails/rails/tree/v5.2.1.rc1/actionview
234
+ changelog_uri: https://github.com/rails/rails/blob/v5.2.1.rc1/actionview/CHANGELOG.md
235
235
  post_install_message:
236
236
  rdoc_options: []
237
237
  require_paths:
@@ -243,13 +243,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
243
243
  version: 2.2.2
244
244
  required_rubygems_version: !ruby/object:Gem::Requirement
245
245
  requirements:
246
- - - ">="
246
+ - - ">"
247
247
  - !ruby/object:Gem::Version
248
- version: '0'
248
+ version: 1.3.1
249
249
  requirements:
250
250
  - none
251
251
  rubyforge_project:
252
- rubygems_version: 2.7.6
252
+ rubygems_version: 2.7.3
253
253
  signing_key:
254
254
  specification_version: 4
255
255
  summary: Rendering framework putting the V in MVC (part of Rails).