Skip to content

Commit

Permalink
Merge pull request #8406 from fjordllc/chore/nokogiri-for-platforms
Browse files Browse the repository at this point in the history
image/jpgのcontent_typeを削除した
  • Loading branch information
komagata authored Mar 6, 2025
2 parents 74738be + 6e031cc commit 8833f3d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/models/article.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Article < ApplicationRecord
validates :thumbnail_type, presence: true
validates :published_at, presence: true, if: :will_be_published?
validates :thumbnail,
content_type: %w[image/png image/jpg image/jpeg],
content_type: %w[image/png image/jpeg],
size: { less_than: 10.megabytes }

paginates_per 24
Expand Down
2 changes: 1 addition & 1 deletion app/models/book.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Book < ApplicationRecord
validates :price, presence: true, numericality: { only_integer: true }
validates :page_url, presence: true
validates :cover,
content_type: %w[image/png image/jpg image/jpeg],
content_type: %w[image/png image/jpeg],
size: { less_than: 10.megabytes }

def cover_url
Expand Down
2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ def validate_uploaded_avatar_content_type
return unless uploaded_avatar

mime_type = Marcel::Magic.by_magic(uploaded_avatar)&.type
return if mime_type&.start_with?('image/png', 'image/jpg', 'image/jpeg', 'image/gif', 'image/heic', 'image/heif')
return if mime_type&.start_with?('image/png', 'image/jpeg', 'image/gif', 'image/heic', 'image/heif')

errors.add(:avatar, 'は指定された拡張子(PNG, JPG, JPEG, GIF, HEIC, HEIF形式)になっていないか、あるいは画像が破損している可能性があります')
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/work.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Work < ApplicationRecord
message: 'は「http://example.com」や「https://example.com」のようなURL形式で入力してください'
}
validates :thumbnail,
content_type: %w[image/png image/jpg image/jpeg],
content_type: %w[image/png image/jpeg],
size: { less_than: 10.megabytes }

def thumbnail_url
Expand Down

0 comments on commit 8833f3d

Please sign in to comment.