]> cat aescling's git repositories - mastodon.git/commit
Fix media attachment size validation not correctly accounting for file type (#16819)
authorClaire <claire.github-309c@sitedethib.com>
Wed, 6 Oct 2021 13:49:32 +0000 (15:49 +0200)
committerGitHub <noreply@github.com>
Wed, 6 Oct 2021 13:49:32 +0000 (14:49 +0100)
commit84ceebe1c4a7fbec883e37b90874145caea7bc76
treef64d143e2f84c559fe88a0869baed8eeb195c463
parent900481b7fa638119b826ed888fc8eaca962ecf55
Fix media attachment size validation not correctly accounting for file type (#16819)

* Fix media attachment size validation not correctly accounting for file type

Fixes a regression introduced in #16724 caused by the fact that kt-paperclip
now correctly runs validations before processing, meaning that file size
verification could not rely on our before_post_processing hook.

Moved the `before_post_processing` hooks to `before_validate` to make sure
the media attachment type is set correctly before the file gets validated.

* Add tests
app/models/media_attachment.rb
spec/models/media_attachment_spec.rb