diff options
-rw-r--r-- | Gemfile | 2 | ||||
-rw-r--r-- | Gemfile.lock | 14 | ||||
-rw-r--r-- | activestorage/lib/active_storage/service/s3_service.rb | 4 | ||||
-rw-r--r-- | activesupport/CHANGELOG.md | 19 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/string/filters.rb | 2 | ||||
-rw-r--r-- | activesupport/test/core_ext/string_ext_test.rb | 5 | ||||
-rw-r--r-- | guides/source/6_0_release_notes.md | 68 | ||||
-rw-r--r-- | railties/Rakefile | 20 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/Gemfile.tt | 2 |
9 files changed, 116 insertions, 20 deletions
@@ -45,7 +45,7 @@ gem "libxml-ruby", platforms: :ruby gem "connection_pool", require: false # for railties app_generator_test -gem "bootsnap", ">= 1.4.2", require: false +gem "bootsnap", ">= 1.4.4", require: false # Active Job group :job do diff --git a/Gemfile.lock b/Gemfile.lock index d15b875864..8d34d9a24b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -167,9 +167,9 @@ GEM childprocess faraday selenium-webdriver - bootsnap (1.4.2) + bootsnap (1.4.4) msgpack (~> 1.0) - bootsnap (1.4.2-java) + bootsnap (1.4.4-java) msgpack (~> 1.0) builder (3.2.3) bunny (2.13.0) @@ -327,10 +327,10 @@ GEM minitest-server (1.0.5) minitest (~> 5.0) mono_logger (1.1.0) - msgpack (1.2.9) - msgpack (1.2.9-java) - msgpack (1.2.9-x64-mingw32) - msgpack (1.2.9-x86-mingw32) + msgpack (1.2.10) + msgpack (1.2.10-java) + msgpack (1.2.10-x64-mingw32) + msgpack (1.2.10-x86-mingw32) multi_json (1.13.1) multipart-post (2.0.0) mustache (1.1.0) @@ -548,7 +548,7 @@ DEPENDENCIES benchmark-ips blade blade-sauce_labs_plugin - bootsnap (>= 1.4.2) + bootsnap (>= 1.4.4) byebug capybara (>= 2.15) connection_pool diff --git a/activestorage/lib/active_storage/service/s3_service.rb b/activestorage/lib/active_storage/service/s3_service.rb index bf94f3f49e..c7e4ec96a2 100644 --- a/activestorage/lib/active_storage/service/s3_service.rb +++ b/activestorage/lib/active_storage/service/s3_service.rb @@ -40,7 +40,7 @@ module ActiveStorage def download_chunk(key, range) instrument :download_chunk, key: key, range: range do - object_for(key).get(range: "bytes=#{range.begin}-#{range.exclude_end? ? range.end - 1 : range.end}").body.read.force_encoding(Encoding::BINARY) + object_for(key).get(range: "bytes=#{range.begin}-#{range.exclude_end? ? range.end - 1 : range.end}").body.string.force_encoding(Encoding::BINARY) rescue Aws::S3::Errors::NoSuchKey raise ActiveStorage::FileNotFoundError end @@ -108,7 +108,7 @@ module ActiveStorage raise ActiveStorage::FileNotFoundError unless object.exists? while offset < object.content_length - yield object.get(range: "bytes=#{offset}-#{offset + chunk_size - 1}").body.read.force_encoding(Encoding::BINARY) + yield object.get(range: "bytes=#{offset}-#{offset + chunk_size - 1}").body.string.force_encoding(Encoding::BINARY) offset += chunk_size end end diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index d1b3b31646..ccdf2c3040 100644 --- a/activesupport/CHANGELOG.md +++ b/activesupport/CHANGELOG.md @@ -1,3 +1,22 @@ +* `truncate` would return the original string if it was too short to be truncated + and a frozen string if it were long enough to be truncated. Now truncate will + consistently return an unfrozen string regardless. This behavior is consistent + with `gsub` and `strip`. + Before: + + 'foobar'.truncate(5).frozen? + => true + 'foobar'.truncate(6).frozen? + => false + + After: + + 'foobar'.truncate(5).frozen? + => false + 'foobar'.truncate(6).frozen? + => false + + *Jordan Thomas* Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/activesupport/CHANGELOG.md) for previous changes. diff --git a/activesupport/lib/active_support/core_ext/string/filters.rb b/activesupport/lib/active_support/core_ext/string/filters.rb index df0e79afa8..7f28bd52f2 100644 --- a/activesupport/lib/active_support/core_ext/string/filters.rb +++ b/activesupport/lib/active_support/core_ext/string/filters.rb @@ -75,7 +75,7 @@ class String length_with_room_for_omission end - "#{self[0, stop]}#{omission}" + +"#{self[0, stop]}#{omission}" end # Truncates +text+ to at most <tt>bytesize</tt> bytes in length without diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb index 4ffa33aa61..c5a000b67a 100644 --- a/activesupport/test/core_ext/string_ext_test.rb +++ b/activesupport/test/core_ext/string_ext_test.rb @@ -291,6 +291,11 @@ class StringInflectionsTest < ActiveSupport::TestCase assert_equal "Hello Big[...]", "Hello Big World!".truncate(15, omission: "[...]", separator: /\s/) end + def test_truncate_returns_frozen_string + assert_not "Hello World!".truncate(12).frozen? + assert_not "Hello World!!".truncate(12).frozen? + end + def test_truncate_bytes assert_equal "👍👍👍👍", "👍👍👍👍".truncate_bytes(16) assert_equal "👍👍👍👍", "👍👍👍👍".truncate_bytes(16, omission: nil) diff --git a/guides/source/6_0_release_notes.md b/guides/source/6_0_release_notes.md index 0a5b13a003..b7f9b82136 100644 --- a/guides/source/6_0_release_notes.md +++ b/guides/source/6_0_release_notes.md @@ -178,10 +178,78 @@ Please refer to the [Changelog][action-pack] for detailed changes. ### Removals +* Remove deprecated `fragment_cache_key` helper in favor of `combined_fragment_cache_key`. + ([Commit](https://github.com/rails/rails/commit/e70d3df7c9b05c129b0fdcca57f66eca316c5cfc)) + +* Remove deprecated methods in `ActionDispatch::TestResponse`: + `#success?` in favor of `#successful?`, `#missing?` in favor of `#not_found?`, + `#error?` in favor of `#server_error?` + ([Commit](https://github.com/rails/rails/commit/13ddc92e079e59a0b894e31bf5bb4fdecbd235d1)) + ### Deprecations +* Deprecate `ActionDispatch::Http::ParameterFilter` in favor of `ActiveSupport::ParameterFilter`. + ([Pull Request](https://github.com/rails/rails/pull/34039)) + +* Deprecate controller level `force_ssl` in favor of `config.force_ssl`. + ([Pull Request](https://github.com/rails/rails/pull/32277)) + ### Notable changes +* Raise an `ArgumentError` if a resource param contains a colon. + ([Pull Request](https://github.com/rails/rails/pull/35236)) + +* Allow `ActionDispatch::SystemTestCase.driven_by` to be called with a block + to define specific browser capabilities. + ([Pull Request](https://github.com/rails/rails/pull/35081)) + +* Add `ActionDispatch::HostAuthorization` middleware that guards against DNS rebinding + attacks. + ([Pull Request](https://github.com/rails/rails/pull/33145)) + +* Allow the use of `parsed_body` in `ActionController::TestCase`. + ([Pull Request](https://github.com/rails/rails/pull/34717)) + +* Raise an `ArgumentError` when multiple root routes exists in the same context + without `as:` naming specifications. + ([Pull Request](https://github.com/rails/rails/pull/34494)) + +* Allow the use of `#rescue_from` for handling parameter parsing errors. + ([Pull Request](https://github.com/rails/rails/pull/34341)) + +* Add `ActionController::Parameters#each_value` for iterating through parameters. + ([Pull Request](https://github.com/rails/rails/pull/33979)) + +* Encode Content-Disposition filenames on `send_data` and `send_file`. + ([Pull Request](https://github.com/rails/rails/pull/33829)) + +* Expose `ActionController::Parameters#each_key`. + ([Pull Request](https://github.com/rails/rails/pull/33758)) + +* Add purpose metadata to signed/encrypted cookies to prevent copying the value of + cookies into one another. + ([Pull Request](https://github.com/rails/rails/pull/32937)) + +* Raise `ActionController::RespondToMismatchError` for conflicting `respond_to` invocations. + ([Pull Request](https://github.com/rails/rails/pull/33446)) + +* Add an explicit error page for when a template is missing for a request format. + ([Pull Request](https://github.com/rails/rails/pull/29286)) + +* Introduce `ActionDispatch::DebugExceptions.register_interceptor`, a way to hook into + DebugExceptions and process the exception, before being rendered. + ([Pull Request](https://github.com/rails/rails/pull/23868)) + +* Output only one Content-Security-Policy nonce header value per request. + ([Pull Request](https://github.com/rails/rails/pull/32602)) + +* Add a module specifically for the Rails default headers configuration + that can be explicitly included in controllers. + ([Pull Request](https://github.com/rails/rails/pull/32484)) + +* Add `#dig` to `ActionDispatch::Request::Session`. + ([Pull Request](https://github.com/rails/rails/pull/32446)) + Action View ----------- diff --git a/railties/Rakefile b/railties/Rakefile index 0f305ea332..51f46d1817 100644 --- a/railties/Rakefile +++ b/railties/Rakefile @@ -95,14 +95,18 @@ namespace :test do ]) puts fake_command - # We could run these in parallel, but pretty much all of the - # railties tests already run in parallel, so ¯\_(⊙︿⊙)_/¯ - Process.waitpid fork { - ARGV.clear.concat test_options - Rake.application = nil - - load file - } + if Process.respond_to?(:fork) + # We could run these in parallel, but pretty much all of the + # railties tests already run in parallel, so ¯\_(⊙︿⊙)_/¯ + Process.waitpid fork { + ARGV.clear.concat test_options + Rake.application = nil + + load file + } + else + Process.wait spawn(fake_command) + end unless $?.success? failing_files << file diff --git a/railties/lib/rails/generators/rails/app/templates/Gemfile.tt b/railties/lib/rails/generators/rails/app/templates/Gemfile.tt index d7221453e7..cf5462f7dc 100644 --- a/railties/lib/rails/generators/rails/app/templates/Gemfile.tt +++ b/railties/lib/rails/generators/rails/app/templates/Gemfile.tt @@ -28,7 +28,7 @@ ruby <%= "'#{RUBY_VERSION}'" -%> <% if depend_on_bootsnap? -%> # Reduces boot times through caching; required in config/boot.rb -gem 'bootsnap', '>= 1.4.2', require: false +gem 'bootsnap', '>= 1.4.4', require: false <%- end -%> <%- if options.api? -%> |