Skip to content

Magento 2.4.4 does not support .webp upload #35836

Open
@H-Toine

Description

@H-Toine

Preconditions and environment

  • Magento 2.4.4

We currently have our own API set up to connect to Magento, and we provide content from this; including images. This includes various mime types, including webp.

Whenever we try to send that image through the Magento REST API, it says it does not support the mime type.

We have also tried uploading an image in the magento admin page for:

  • Catalog -> Products -> Product -> Image Gallery -> Upload
    vivaldi_Gtzkt5wu4P
  • Content -> Page -> Insert Image -> Upload
    vivaldi_KWKKvDOGgh

Steps to reproduce

Below the steps to reproduce the issue with the REST API:

  1. Set up Rest API
  2. Send .webp image to the REST API as base64 through http://my.magento.com/rest/all/V1/products/{id}/media
{
    "entry": {
        "media_type": "image",
        "label": "My WEBP Image",
        "position": "3",
        "disabled": false,
        "types": [],
        "content": {
            "base64_encoded_data": "................",
            "type": "image/webp",
            "name": "WebP_Logo.webp"
        }
    }
}

Expected result

Image is added to the gallery of the specified product.

Actual result

Error 400 Bad Request: {"message":"The image MIME type is not valid or not supported."}.
On API Call: |POST| http://my.magento.com/rest/all/V1/products/{id}/media

Additional information

Magento\Framework\Api\ImageContentValidator

has the following allowed mime types:

private $defaultMimeTypes = [
    'image/jpg',
    'image/jpeg',
    'image/gif',
    'image/png',
];

There are other classes that have this same list of $defaultMimeTypes and $allowedMimeTypes.

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions