activesupport 6.0.3.2 → 6.0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ddc3765b575ed4e835c62deb6d50ce258b79785b3b8f006e0a8cd5ce029afb5c
4
- data.tar.gz: 7cb48c556646fcb7ed94a2413309093e39f45ea6ce35f8bf2dafadcce7c4dba5
3
+ metadata.gz: 52a46b0c7530ac21c8d830c74ceaffe6860946aaa5730a7fb0f62e3a743da504
4
+ data.tar.gz: 2e493f1adb8b54874d66b456fcfba28a51211627be88ca1f5438262608970704
5
5
  SHA512:
6
- metadata.gz: c385b04bb40eab25a93d8d72da2ec89ac8ae4dde7cf970664615ae61c8396d2071233cbc5ef96170af91b0787f9e427298979ec9a053147210930de68ee49626
7
- data.tar.gz: e5acd9a96d62ac48111133e99eb69d656685e7ab0596e348dcf8ff6ee9fdcc6aec073738ff40ab49a5df51e873ed4404ac2d8e4c00d12447dd2b8a1d495967e3
6
+ metadata.gz: 86d40180f1cd17c14a76ada32542b392d5058cb490acf0186ef82f62683077088092f3c040f5da8102417660d0b2ed3aa8018f94e1227eef702f3f31dc24f4a7
7
+ data.tar.gz: 930e0cb9ffb349b17cdc99adf60ae1d40c88c545a2a9d34c9f58a3242cf8101c087a850055c9ae3907197c5613321eeb6a65577cc007d1b2eca32eae1289279a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,107 @@
1
+ ## Rails 6.0.6.1 (January 17, 2023) ##
2
+
3
+ * No changes.
4
+
5
+
6
+ ## Rails 6.0.6 (September 09, 2022) ##
7
+
8
+ * No changes.
9
+
10
+
11
+ ## Rails 6.0.5.1 (July 12, 2022) ##
12
+
13
+ * No changes.
14
+
15
+
16
+ ## Rails 6.0.5 (May 09, 2022) ##
17
+
18
+ * No changes.
19
+
20
+
21
+ ## Rails 6.0.4.8 (April 26, 2022) ##
22
+
23
+ * Fix and add protections for XSS in `ActionView::Helpers` and `ERB::Util`.
24
+
25
+ Add the method `ERB::Util.xml_name_escape` to escape dangerous characters
26
+ in names of tags and names of attributes, following the specification of XML.
27
+
28
+ *Álvaro Martín Fraguas*
29
+
30
+
31
+ ## Rails 6.0.4.7 (March 08, 2022) ##
32
+
33
+ * No changes.
34
+
35
+
36
+ ## Rails 6.0.4.6 (February 11, 2022) ##
37
+
38
+ * Fix Reloader method signature to work with the new Executor signature
39
+
40
+
41
+ ## Rails 6.0.4.5 (February 11, 2022) ##
42
+
43
+ * No changes.
44
+
45
+
46
+ ## Rails 6.0.4.4 (December 15, 2021) ##
47
+
48
+ * No changes.
49
+
50
+
51
+ ## Rails 6.0.4.3 (December 14, 2021) ##
52
+
53
+ * No changes.
54
+
55
+
56
+ ## Rails 6.0.4.2 (December 14, 2021) ##
57
+
58
+ * No changes.
59
+
60
+
61
+ ## Rails 6.0.4.1 (August 19, 2021) ##
62
+
63
+ * No changes.
64
+
65
+
66
+ ## Rails 6.0.4 (June 15, 2021) ##
67
+
68
+ * Fixed issue in `ActiveSupport::Cache::RedisCacheStore` not passing options
69
+ to `read_multi` causing `fetch_multi` to not work properly.
70
+
71
+ *Rajesh Sharma*
72
+
73
+ * `with_options` copies its options hash again to avoid leaking mutations.
74
+
75
+ Fixes #39343.
76
+
77
+ *Eugene Kenny*
78
+
79
+
80
+ ## Rails 6.0.3.7 (May 05, 2021) ##
81
+
82
+ * No changes.
83
+
84
+
85
+ ## Rails 6.0.3.6 (March 26, 2021) ##
86
+
87
+ * No changes.
88
+
89
+
90
+ ## Rails 6.0.3.5 (February 10, 2021) ##
91
+
92
+ * No changes.
93
+
94
+
95
+ ## Rails 6.0.3.4 (October 07, 2020) ##
96
+
97
+ * No changes.
98
+
99
+
100
+ ## Rails 6.0.3.3 (September 09, 2020) ##
101
+
102
+ * No changes.
103
+
104
+
1
105
  ## Rails 6.0.3.2 (June 17, 2020) ##
2
106
 
3
107
  * No changes.
@@ -9,6 +113,7 @@
9
113
 
10
114
  * [CVE-2020-8165] Avoid Marshal.load on raw cache value in MemCacheStore
11
115
 
116
+
12
117
  ## Rails 6.0.3 (May 06, 2020) ##
13
118
 
14
119
  * `Array#to_sentence` no longer returns a frozen string.
@@ -174,6 +279,12 @@
174
279
 
175
280
  ## Rails 6.0.0.rc1 (April 24, 2019) ##
176
281
 
282
+ * Speed improvements to `Hash.except` and `HashWithIndifferentAccess#except`.
283
+
284
+ These methods now unset the `default`/`default_proc` on the returned Hash, compatible with Ruby 3.0’s native implementation.
285
+
286
+ *Timo Schilling*
287
+
177
288
  * Introduce `ActiveSupport::ActionableError`.
178
289
 
179
290
  Actionable errors let's you dispatch actions from Rails' error pages. This
data/README.rdoc CHANGED
@@ -15,7 +15,7 @@ The latest version of Active Support can be installed with RubyGems:
15
15
 
16
16
  Source code can be downloaded as part of the Rails project on GitHub:
17
17
 
18
- * https://github.com/rails/rails/tree/master/activesupport
18
+ * https://github.com/rails/rails/tree/main/activesupport
19
19
 
20
20
 
21
21
  == License
@@ -16,7 +16,7 @@ module ActiveSupport
16
16
  attr_reader :cache_path
17
17
 
18
18
  DIR_FORMATTER = "%03X"
19
- FILENAME_MAX_SIZE = 228 # max filename size on file system is 255, minus room for timestamp and random characters appended by Tempfile (used by atomic write)
19
+ FILENAME_MAX_SIZE = 226 # max filename size on file system is 255, minus room for timestamp, pid, and random characters appended by Tempfile (used by atomic write)
20
20
  FILEPATH_MAX_SIZE = 900 # max is 1024, plus some room
21
21
  GITKEEP_FILES = [".gitkeep", ".keep"].freeze
22
22
 
@@ -74,7 +74,8 @@ module ActiveSupport
74
74
  private
75
75
  def read_entry(key, **options)
76
76
  if File.exist?(key)
77
- File.open(key) { |f| Marshal.load(f) }
77
+ entry = File.open(key) { |f| Marshal.load(f) }
78
+ entry if entry.is_a?(Cache::Entry)
78
79
  end
79
80
  rescue => e
80
81
  logger.error("FileStoreError (#{e}): #{e.message}") if logger
@@ -7,6 +7,7 @@ rescue LoadError => e
7
7
  raise e
8
8
  end
9
9
 
10
+ require "active_support/core_ext/marshal"
10
11
  require "active_support/core_ext/array/extract_options"
11
12
 
12
13
  module ActiveSupport
@@ -347,7 +347,7 @@ module ActiveSupport
347
347
 
348
348
  def read_multi_entries(names, **options)
349
349
  if mget_capable?
350
- read_multi_mget(*names)
350
+ read_multi_mget(*names, **options)
351
351
  else
352
352
  super
353
353
  end
@@ -394,7 +394,7 @@ module ActiveSupport
394
394
  modifiers[:nx] = unless_exist
395
395
  modifiers[:px] = (1000 * expires_in.to_f).ceil if expires_in
396
396
 
397
- redis.with { |c| c.set key, serialized_entry, modifiers }
397
+ redis.with { |c| c.set key, serialized_entry, **modifiers }
398
398
  else
399
399
  redis.with { |c| c.set key, serialized_entry }
400
400
  end
@@ -160,7 +160,7 @@ module ActiveSupport
160
160
  cache = local_cache
161
161
  cache.mute do
162
162
  if value
163
- cache.write(name, value, **options)
163
+ cache.write(name, value, options)
164
164
  else
165
165
  cache.delete(name, **options)
166
166
  end
@@ -312,7 +312,7 @@ module ActiveSupport
312
312
  # :bar
313
313
  # end
314
314
  # cache.fetch('foo') # => "bar"
315
- def fetch(name, options = nil)
315
+ def fetch(name, options = nil, &block)
316
316
  if block_given?
317
317
  options = merged_options(options)
318
318
  key = normalize_key(name, options)
@@ -327,9 +327,9 @@ module ActiveSupport
327
327
  end
328
328
 
329
329
  if entry
330
- get_entry_value(entry, name, **options)
330
+ get_entry_value(entry, name, options)
331
331
  else
332
- save_block_result_to_cache(name, **options) { |_name| yield _name }
332
+ save_block_result_to_cache(name, options, &block)
333
333
  end
334
334
  elsif options && options[:force]
335
335
  raise ArgumentError, "Missing block: Calling `Cache#fetch` with `force: true` requires a block."
@@ -448,7 +448,7 @@ module ActiveSupport
448
448
  payload[:hits] = reads.keys
449
449
  payload[:super_operation] = :fetch_multi
450
450
 
451
- write_multi(writes, **options)
451
+ write_multi(writes, options)
452
452
 
453
453
  ordered
454
454
  end
@@ -712,7 +712,7 @@ module ActiveSupport
712
712
  entry.value
713
713
  end
714
714
 
715
- def save_block_result_to_cache(name, **options)
715
+ def save_block_result_to_cache(name, options)
716
716
  result = instrument(:generate, name, options) do
717
717
  yield(name)
718
718
  end
@@ -11,7 +11,7 @@ class Hash
11
11
  # @person.update(params[:person].except(:admin))
12
12
  def except(*keys)
13
13
  slice(*self.keys - keys)
14
- end
14
+ end unless method_defined?(:except)
15
15
 
16
16
  # Removes the given keys from hash and returns it.
17
17
  # hash = { a: true, b: false, c: nil }
@@ -45,7 +45,7 @@ module ActiveSupport
45
45
  end
46
46
  end
47
47
 
48
- [Object, Array, FalseClass, Float, Hash, Integer, NilClass, String, TrueClass, Enumerable].reverse_each do |klass|
48
+ [Enumerable, Object, Array, FalseClass, Float, Hash, Integer, NilClass, String, TrueClass].reverse_each do |klass|
49
49
  klass.prepend(ActiveSupport::ToJsonWithActiveSupportEncoder)
50
50
  end
51
51
 
@@ -12,6 +12,14 @@ class ERB
12
12
  HTML_ESCAPE_ONCE_REGEXP = /["><']|&(?!([a-zA-Z]+|(#\d+)|(#[xX][\dA-Fa-f]+));)/
13
13
  JSON_ESCAPE_REGEXP = /[\u2028\u2029&><]/u
14
14
 
15
+ # Following XML requirements: https://www.w3.org/TR/REC-xml/#NT-Name
16
+ TAG_NAME_START_REGEXP_SET = "@:A-Z_a-z\u{C0}-\u{D6}\u{D8}-\u{F6}\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}" \
17
+ "\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}" \
18
+ "\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}"
19
+ TAG_NAME_START_REGEXP = /[^#{TAG_NAME_START_REGEXP_SET}]/
20
+ TAG_NAME_FOLLOWING_REGEXP = /[^#{TAG_NAME_START_REGEXP_SET}\-.0-9\u{B7}\u{0300}-\u{036F}\u{203F}-\u{2040}]/
21
+ TAG_NAME_REPLACEMENT_CHAR = "_"
22
+
15
23
  # A utility method for escaping HTML tag characters.
16
24
  # This method is also aliased as <tt>h</tt>.
17
25
  #
@@ -116,6 +124,26 @@ class ERB
116
124
  end
117
125
 
118
126
  module_function :json_escape
127
+
128
+ # A utility method for escaping XML names of tags and names of attributes.
129
+ #
130
+ # xml_name_escape('1 < 2 & 3')
131
+ # # => "1___2___3"
132
+ #
133
+ # It follows the requirements of the specification: https://www.w3.org/TR/REC-xml/#NT-Name
134
+ def xml_name_escape(name)
135
+ name = name.to_s
136
+ return "" if name.blank?
137
+
138
+ starting_char = name[0].gsub(TAG_NAME_START_REGEXP, TAG_NAME_REPLACEMENT_CHAR)
139
+
140
+ return starting_char if name.size == 1
141
+
142
+ following_chars = name[1..-1].gsub(TAG_NAME_FOLLOWING_REGEXP, TAG_NAME_REPLACEMENT_CHAR)
143
+
144
+ starting_char + following_chars
145
+ end
146
+ module_function :xml_name_escape
119
147
  end
120
148
  end
121
149
 
@@ -135,7 +163,7 @@ module ActiveSupport #:nodoc:
135
163
  class SafeBuffer < String
136
164
  UNSAFE_STRING_METHODS = %w(
137
165
  capitalize chomp chop delete delete_prefix delete_suffix
138
- downcase lstrip next reverse rstrip slice squeeze strip
166
+ downcase lstrip next reverse rstrip scrub slice squeeze strip
139
167
  succ swapcase tr tr_s unicode_normalize upcase
140
168
  )
141
169
 
@@ -153,12 +181,12 @@ module ActiveSupport #:nodoc:
153
181
 
154
182
  def [](*args)
155
183
  if html_safe?
156
- new_safe_buffer = super
184
+ new_string = super
157
185
 
158
- if new_safe_buffer
159
- new_safe_buffer.instance_variable_set :@html_safe, true
160
- end
186
+ return unless new_string
161
187
 
188
+ new_safe_buffer = new_string.is_a?(SafeBuffer) ? new_string : SafeBuffer.new(new_string)
189
+ new_safe_buffer.instance_variable_set :@html_safe, true
162
190
  new_safe_buffer
163
191
  else
164
192
  to_str[*args]
@@ -214,7 +242,8 @@ module ActiveSupport #:nodoc:
214
242
  end
215
243
 
216
244
  def *(*)
217
- new_safe_buffer = super
245
+ new_string = super
246
+ new_safe_buffer = new_string.is_a?(SafeBuffer) ? new_string : SafeBuffer.new(new_string)
218
247
  new_safe_buffer.instance_variable_set(:@html_safe, @html_safe)
219
248
  new_safe_buffer
220
249
  end
@@ -47,7 +47,9 @@ class Time
47
47
  # Time.at can be called with a time or numerical value
48
48
  time_or_number = args.first
49
49
 
50
- if time_or_number.is_a?(ActiveSupport::TimeWithZone) || time_or_number.is_a?(DateTime)
50
+ if time_or_number.is_a?(ActiveSupport::TimeWithZone)
51
+ at_without_coercion(time_or_number.to_r).getlocal
52
+ elsif time_or_number.is_a?(DateTime)
51
53
  at_without_coercion(time_or_number.to_f).getlocal
52
54
  else
53
55
  at_without_coercion(time_or_number)
@@ -367,7 +367,12 @@ module ActiveSupport #:nodoc:
367
367
  require_or_load(path || file_name)
368
368
  rescue LoadError => load_error
369
369
  if file_name = load_error.message[/ -- (.*?)(\.rb)?$/, 1]
370
- load_error.message.replace(message % file_name)
370
+ load_error_message = if load_error.respond_to?(:original_message)
371
+ load_error.original_message
372
+ else
373
+ load_error.message
374
+ end
375
+ load_error_message.replace(message % file_name)
371
376
  load_error.copy_blame!(load_error)
372
377
  end
373
378
  raise
@@ -147,7 +147,7 @@ module ActiveSupport
147
147
 
148
148
  # Don't give a deprecation warning on methods that IRB may invoke
149
149
  # during tab-completion.
150
- delegate :hash, :instance_methods, :name, to: :target
150
+ delegate :hash, :instance_methods, :name, :respond_to?, to: :target
151
151
 
152
152
  # Returns the class of the new constant.
153
153
  #
@@ -63,18 +63,21 @@ module ActiveSupport
63
63
  # after the work has been performed.
64
64
  #
65
65
  # Where possible, prefer +wrap+.
66
- def self.run!
67
- if active?
68
- Null
66
+ def self.run!(reset: false)
67
+ if reset
68
+ lost_instance = active.delete(Thread.current)
69
+ lost_instance&.complete!
69
70
  else
70
- new.tap do |instance|
71
- success = nil
72
- begin
73
- instance.run!
74
- success = true
75
- ensure
76
- instance.complete! unless success
77
- end
71
+ return Null if active?
72
+ end
73
+
74
+ new.tap do |instance|
75
+ success = nil
76
+ begin
77
+ instance.run!
78
+ success = true
79
+ ensure
80
+ instance.complete! unless success
78
81
  end
79
82
  end
80
83
  end
@@ -103,11 +106,11 @@ module ActiveSupport
103
106
  self.active = Concurrent::Hash.new
104
107
 
105
108
  def self.active? # :nodoc:
106
- @active[Thread.current]
109
+ @active.key?(Thread.current)
107
110
  end
108
111
 
109
112
  def run! # :nodoc:
110
- self.class.active[Thread.current] = true
113
+ self.class.active[Thread.current] = self
111
114
  run_callbacks(:run)
112
115
  end
113
116
 
@@ -9,8 +9,8 @@ module ActiveSupport
9
9
  module VERSION
10
10
  MAJOR = 6
11
11
  MINOR = 0
12
- TINY = 3
13
- PRE = "2"
12
+ TINY = 6
13
+ PRE = "1"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -7,7 +7,7 @@ module ActiveSupport
7
7
  class Metadata #:nodoc:
8
8
  def initialize(message, expires_at = nil, purpose = nil)
9
9
  @message, @purpose = message, purpose
10
- @expires_at = expires_at.is_a?(String) ? Time.iso8601(expires_at) : expires_at
10
+ @expires_at = expires_at.is_a?(String) ? parse_expires_at(expires_at) : expires_at
11
11
  end
12
12
 
13
13
  def as_json(options = {})
@@ -67,6 +67,14 @@ module ActiveSupport
67
67
  def fresh?
68
68
  @expires_at.nil? || Time.now.utc < @expires_at
69
69
  end
70
+
71
+ def parse_expires_at(expires_at)
72
+ if ActiveSupport.use_standard_json_time_format
73
+ Time.iso8601(expires_at)
74
+ else
75
+ Time.parse(expires_at)
76
+ end
77
+ end
70
78
  end
71
79
  end
72
80
  end
@@ -9,15 +9,11 @@ module ActiveSupport
9
9
 
10
10
  def convert
11
11
  number = self.number.to_s.strip
12
- number_f = number.to_f
13
12
  format = options[:format]
14
13
 
15
- if number_f.negative?
16
- number = number_f.abs
17
-
18
- unless options[:precision] == 0 && number < 0.5
19
- format = options[:negative_format]
20
- end
14
+ if number.sub!(/^-/, "") &&
15
+ (options[:precision] != 0 || number.to_f > 0.5)
16
+ format = options[:negative_format]
21
17
  end
22
18
 
23
19
  rounded_number = NumberToRoundedConverter.convert(number, options)
@@ -26,7 +26,7 @@ module ActiveSupport
26
26
 
27
27
  private
28
28
  def round_without_significant(number)
29
- number = number.round(precision)
29
+ number = number.round(precision, BigDecimal.mode(BigDecimal::ROUND_MODE))
30
30
  number = number.to_i if precision == 0 && number.finite?
31
31
  number = number.abs if number.zero? # prevent showing negative zeros
32
32
  number
@@ -37,7 +37,7 @@ module ActiveSupport
37
37
  end
38
38
  else
39
39
  def invoke_method(method, arguments, options, &block)
40
- arguments << options if options
40
+ arguments << options.dup if options
41
41
  @context.__send__(method, *arguments, &block)
42
42
  end
43
43
  end
@@ -58,7 +58,7 @@ module ActiveSupport
58
58
  prepare!
59
59
  end
60
60
 
61
- def self.run! # :nodoc:
61
+ def self.run!(reset: false) # :nodoc:
62
62
  if check!
63
63
  super
64
64
  else
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activesupport
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.3.2
4
+ version: 6.0.6.1
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: 2020-06-17 00:00:00.000000000 Z
11
+ date: 2023-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -359,10 +359,11 @@ licenses:
359
359
  - MIT
360
360
  metadata:
361
361
  bug_tracker_uri: https://github.com/rails/rails/issues
362
- changelog_uri: https://github.com/rails/rails/blob/v6.0.3.2/activesupport/CHANGELOG.md
363
- documentation_uri: https://api.rubyonrails.org/v6.0.3.2/
362
+ changelog_uri: https://github.com/rails/rails/blob/v6.0.6.1/activesupport/CHANGELOG.md
363
+ documentation_uri: https://api.rubyonrails.org/v6.0.6.1/
364
364
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
365
- source_code_uri: https://github.com/rails/rails/tree/v6.0.3.2/activesupport
365
+ source_code_uri: https://github.com/rails/rails/tree/v6.0.6.1/activesupport
366
+ rubygems_mfa_required: 'true'
366
367
  post_install_message:
367
368
  rdoc_options:
368
369
  - "--encoding"
@@ -380,7 +381,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
380
381
  - !ruby/object:Gem::Version
381
382
  version: '0'
382
383
  requirements: []
383
- rubygems_version: 3.1.2
384
+ rubygems_version: 3.4.3
384
385
  signing_key:
385
386
  specification_version: 4
386
387
  summary: A toolkit of support libraries and Ruby core extensions extracted from the