mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Specify a list of content-types
Then remove specific image format that aren't handled by a web browser (such as `image/x+xcf)` + List allowed image formats for enterprises and groups
This commit is contained in:
@@ -84,8 +84,8 @@ class Enterprise < ApplicationRecord
|
||||
has_one_attached :promo_image
|
||||
has_one_attached :terms_and_conditions
|
||||
|
||||
validates :logo, content_type: %r{\Aimage/.*\Z}
|
||||
validates :promo_image, content_type: %r{\Aimage/.*\Z}
|
||||
validates :logo, content_type: %r{\Aimage/(png|jpeg|gif|jpg|svg\+xml)\Z}
|
||||
validates :promo_image, content_type: %r{\Aimage/(png|jpeg|gif|jpg|svg\+xml)\Z}
|
||||
validates :terms_and_conditions, content_type: {
|
||||
in: "application/pdf",
|
||||
message: I18n.t(:enterprise_terms_and_conditions_type_error),
|
||||
|
||||
@@ -28,8 +28,8 @@ class EnterpriseGroup < ApplicationRecord
|
||||
has_one_attached :logo
|
||||
has_one_attached :promo_image
|
||||
|
||||
validates :logo, content_type: %r{\Aimage/.*\Z}
|
||||
validates :promo_image, content_type: %r{\Aimage/.*\Z}
|
||||
validates :logo, content_type: %r{\Aimage/(png|jpeg|gif|jpg|svg\+xml)\Z}
|
||||
validates :promo_image, content_type: %r{\Aimage/(png|jpeg|gif|jpg|svg\+xml)\Z}
|
||||
|
||||
scope :by_position, -> { order('position ASC') }
|
||||
scope :on_front_page, -> { where(on_front_page: true) }
|
||||
|
||||
@@ -11,7 +11,7 @@ module Spree
|
||||
|
||||
has_one_attached :attachment
|
||||
|
||||
validates :attachment, attached: true, content_type: %r{\Aimage/.*\Z}
|
||||
validates :attachment, attached: true, content_type: %r{\Aimage/(png|jpeg|gif|jpg|svg\+xml)\Z}
|
||||
validate :no_attachment_errors
|
||||
|
||||
def variant(name)
|
||||
|
||||
Reference in New Issue
Block a user