diff --git a/app/models/enterprise.rb b/app/models/enterprise.rb index bd49da2bdc..e08d508ad2 100644 --- a/app/models/enterprise.rb +++ b/app/models/enterprise.rb @@ -84,8 +84,8 @@ class Enterprise < ApplicationRecord has_one_attached :promo_image has_one_attached :terms_and_conditions - 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 :logo, content_type: %r{\Aimage/(png|jpeg|gif|jpg|svg\+xml|webp)\Z} + validates :promo_image, content_type: %r{\Aimage/(png|jpeg|gif|jpg|svg\+xml|webp)\Z} validates :terms_and_conditions, content_type: { in: "application/pdf", message: I18n.t(:enterprise_terms_and_conditions_type_error), diff --git a/app/models/enterprise_group.rb b/app/models/enterprise_group.rb index 60d2516890..a791405965 100644 --- a/app/models/enterprise_group.rb +++ b/app/models/enterprise_group.rb @@ -28,8 +28,8 @@ class EnterpriseGroup < ApplicationRecord has_one_attached :logo has_one_attached :promo_image - 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 :logo, content_type: %r{\Aimage/(png|jpeg|gif|jpg|svg\+xml|webp)\Z} + validates :promo_image, content_type: %r{\Aimage/(png|jpeg|gif|jpg|svg\+xml|webp)\Z} scope :by_position, -> { order('position ASC') } scope :on_front_page, -> { where(on_front_page: true) } diff --git a/app/models/spree/image.rb b/app/models/spree/image.rb index 25eca61bf8..4c28ed121a 100644 --- a/app/models/spree/image.rb +++ b/app/models/spree/image.rb @@ -11,7 +11,7 @@ module Spree has_one_attached :attachment - validates :attachment, attached: true, content_type: %r{\Aimage/(png|jpeg|gif|jpg|svg\+xml)\Z} + validates :attachment, attached: true, content_type: %r{\Aimage/(png|jpeg|gif|jpg|svg\+xml|webp)\Z} validate :no_attachment_errors def variant(name) diff --git a/config/locales/en.yml b/config/locales/en.yml index b13fc82203..0242152296 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -3926,7 +3926,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using paypal: no_payment_via_admin_backend: Paypal payments cannot be captured in the Backoffice products: - image_upload_error: "The product image was not recognised. Please upload an image in PNG or JPG format." + image_upload_error: "Please upload the image in JPG, PNG, GIF, SVG or WEBP format." new: title: "New Product" new_product: "New Product" diff --git a/spec/system/admin/products_spec.rb b/spec/system/admin/products_spec.rb index abbc1963ca..0595ec2259 100644 --- a/spec/system/admin/products_spec.rb +++ b/spec/system/admin/products_spec.rb @@ -590,8 +590,8 @@ describe ' attach_file('image_attachment', unsupported_image_file_path) click_button "Create" - expect(page).to have_text "The product image was not recognised." - expect(page).to have_text "Please upload an image in PNG or JPG format." + expect(page).to have_text "Attachment has an invalid content type" + expect(page).to have_text "Please upload the image in JPG, PNG, GIF, SVG or WEBP format." end it "deleting product images", js: true do