diff options
author | Thibaut Girka <thib@sitedethib.com> | 2019-10-03 11:10:12 +0200 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2019-10-03 11:10:12 +0200 |
commit | a84aedb7a7f050cbf5293351723f55a904992b3a (patch) | |
tree | 769d397390665bcddf9b44fc1ad4418b2757c5f1 /app/models/concerns | |
parent | 857c67f31b23b9c496e07eda41755ba449a37f17 (diff) | |
parent | bae268b2f6501ccb0ceeb8dd36180698839c4d3c (diff) |
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts: - app/models/media_attachment.rb Upstream raised max image size from 8MB to 10MB while our limit is configurable. Raised the default to 10MB.
Diffstat (limited to 'app/models/concerns')
-rw-r--r-- | app/models/concerns/attachmentable.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/app/models/concerns/attachmentable.rb b/app/models/concerns/attachmentable.rb index 246c2c27c..3bbc6453c 100644 --- a/app/models/concerns/attachmentable.rb +++ b/app/models/concerns/attachmentable.rb @@ -6,6 +6,7 @@ module Attachmentable extend ActiveSupport::Concern MAX_MATRIX_LIMIT = 16_777_216 # 4096x4096px or approx. 16MB + GIF_MATRIX_LIMIT = 921_600 # 1280x720px included do before_post_process :set_file_extensions @@ -42,8 +43,9 @@ module Attachmentable next 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 - raise Mastodon::DimensionsValidationError, "#{width}x#{height} images are not supported, must be below #{MAX_MATRIX_LIMIT} sqpx" if width.present? && height.present? && (width * height >= MAX_MATRIX_LIMIT) + raise Mastodon::DimensionsValidationError, "#{width}x#{height} images are not supported" if width.present? && height.present? && (width * height > matrix_limit) end end |