Description
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:
Steps to reproduce
Below the steps to reproduce the issue with the REST API:
- Set up Rest API
- 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
Assignees
Type
Projects
Status