Fix ActiveStorage::IntegrityError when attaching PDFs
This is an error we've only been able to reproduce on one specific machine and only when using the development environment. It looks like Rails 7.1.5.1 uses `ActiveStorage::PreviewImageJob` when we attach a PDF. However, that raises an IntegrityError because we're removing the metadata from PDFs. That is, the final PDF is no longer the same PDF that was uploaded. This issue wasn't present in the original Rails 7.1.0 release, but was introduced in Rails 7.1.4 [1] and has already been fixed in Rails 7.2.0 [2]. So we're applying the same solution that was applied in Rails 7.2.0: disabling automatic previews for PDFs when no variants require them by changing a method in `ActiveStorage::Attachment`. [1] See commit 6f729dd39 in https://github.com/rails/rails/ [2] See pull request 51351 in https://github.com/rails/rails/
This commit is contained in:
@@ -12,6 +12,7 @@ AllCops:
|
||||
Exclude:
|
||||
- "db/schema.rb"
|
||||
- "app/lib/ckeditor/backend/active_storage.rb"
|
||||
- "config/initializers/disable_active_storage_pdf_auto_previews.rb"
|
||||
- "vendor/**/*"
|
||||
DisabledByDefault: true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user