diff options
author | Claire <claire.github-309c@sitedethib.com> | 2023-11-24 10:31:28 +0100 |
---|---|---|
committer | Claire <claire.github-309c@sitedethib.com> | 2023-12-04 15:28:02 +0100 |
commit | 613d00706c3177b345feeafd0f797e31fd5ba2fe (patch) | |
tree | 35d0cbd2ba0a143a39bc8b72aa1dbd3d02959507 | |
parent | 8bbe2b970f8cd0c62c83616886c7084d9c93c167 (diff) |
Change GIF max matrix size error to explicitly mention GIF files (#27927)
-rw-r--r-- | app/models/concerns/attachmentable.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/models/concerns/attachmentable.rb b/app/models/concerns/attachmentable.rb index 662b2ef529b..a61c78dda17 100644 --- a/app/models/concerns/attachmentable.rb +++ b/app/models/concerns/attachmentable.rb @@ -52,9 +52,13 @@ module Attachmentable return if attachment.blank? || !/image.*/.match?(attachment.content_type) || attachment.queued_for_write[:original].blank? width, height = FastImage.size(attachment.queued_for_write[:original].path) - matrix_limit = attachment.content_type == 'image/gif' ? GIF_MATRIX_LIMIT : MAX_MATRIX_LIMIT + return unless width.present? && height.present? - raise Mastodon::DimensionsValidationError, "#{width}x#{height} images are not supported" if width.present? && height.present? && (width * height > matrix_limit) + if attachment.content_type == 'image/gif' && width * height > GIF_MATRIX_LIMIT + raise Mastodon::DimensionsValidationError, "#{width}x#{height} GIF files are not supported" + elsif width * height > MAX_MATRIX_LIMIT + raise Mastodon::DimensionsValidationError, "#{width}x#{height} images are not supported" + end end def appropriate_extension(attachment) |