SpinaCMS / Spina

Spina CMS
http://www.spinacms.com
Other
2.19k stars 405 forks source link

Attachment/Document Upload Issue in Rails 7 #1010

Closed zenonas closed 2 years ago

zenonas commented 2 years ago

Thank you for the great work on Spina! We've been using it for a while and on upgrading to Rails 7 (7.0.2.3) we've noticed that Uploading documents in the Media Library started throwing MessageVerifier::InvalidSignature exceptions resulting in a broken Attachment saved in the database that needs to be manually deleted as that totally breaks the Documents in the Media Library.

I've reproduced the issue on a clean install of Rails with no other dependencies other than Spina and it seems to be related with Rails adding a new default behaviour if you move to

config.load_defaults 7.0

where config.active_storage.multiple_file_field_include_hidden: true

This tripped us up and made it very annoying tracing it down as the Rails upgrade that creates "new_framework_defaults_7_0.rb" does not seem to include it in as on of the options to manually turn on.

Workaround

In any case a workaround to get Attachment working is to either stay on load_defaults 6.1 or use the 7.0 and manually turn off the multiple_file_field_include_hidden.

Setup details

Ruby 3.1.1 (verified behaviour on 3.1.0 too but its irellevant) Rails 7.0.2.3 (verified issue on 7.0.2.2 as well) Spina 2.8.1 (verified on 2.9.0 as well)

Bramjetten commented 2 years ago

Thanks for figuring this out! I merged a fix.