Merge pull request #5497 from consuldemocracy/active_storage_messages
Keep rendering pre-Rails7 ActiveStorage images
This commit is contained in:
@@ -1,3 +1,16 @@
|
||||
# This code was copied from:
|
||||
# https://github.com/hotwired/turbo-rails/blob/v1.4.0/UPGRADING.md#key-digest-changes-in-111
|
||||
# Removing this code will make ActiveStorage image URLs generated with Rails 6.1
|
||||
# or earlier inaccessible, causing images attached with CKEditor or linked from
|
||||
# somewhere else not to be rendered.
|
||||
Rails.application.config.after_initialize do |app|
|
||||
key_generator = ActiveSupport::KeyGenerator.new(
|
||||
app.secret_key_base, iterations: 1000, hash_digest_class: OpenSSL::Digest::SHA1
|
||||
)
|
||||
|
||||
app.message_verifier("ActiveStorage").rotate(key_generator.generate_key("ActiveStorage"))
|
||||
end
|
||||
|
||||
# This code was copied from:
|
||||
# https://guides.rubyonrails.org/v7.0/upgrading_ruby_on_rails.html#key-generator-digest-class-changing-to-use-sha256
|
||||
# TODO: safe to remove after upgrading to Rails 7.1 or releasing a new
|
||||
Reference in New Issue
Block a user