ACP2E-3789: Media files duplicated on product update via WebAPI
The ACP2E-3789 patch fixes the issue where product updates via WebAPI duplicate media files when a media ID is provided. This patch is available when the Quality Patches Tool (QPT) 1.1.66 is installed. The patch ID is ACP2E-3789. Please note that this issue is scheduled to be fixed in ÃÛ¶¹ÊÓÆµ Commerce 2.4.9.
Affected products and versions
The patch is created for ÃÛ¶¹ÊÓÆµ Commerce version:
- ÃÛ¶¹ÊÓÆµ Commerce (all deployment methods) 2.4.7-p3
Compatible with ÃÛ¶¹ÊÓÆµ Commerce versions:
- ÃÛ¶¹ÊÓÆµ Commerce (all deployment methods) 2.4.5 - 2.4.8
magento/quality-patches
package to the latest version and check the compatibility on the Quality Patches Tool: Search for patches page. Use the patch ID as a search keyword to locate the patch.Issue
Updating a product via WebAPI with a media ID causes the system to duplicate media files instead of replacing them, creating new files with each API call and resulting in a buildup of images that overloads the /pub/media/catalog/products/cache/
directory.
Steps to reproduce:
- Create a product and add an image.
- Get product details using the REST API at
base_url/rest/V1/products/<sku>
. - Perform a PUT request to update the product, keeping the
media_gallery_entrie
s unchanged (same image name and file). - Check the
pub/media/catalog/product/xx/yy
directory before and after the update.
Expected results:
The image file is replaced when the media ID is included in the request.
Actual results:
The image is duplicated with a new name (for example, wb04-blue-1.jpg), causing unnecessary file buildup.
Apply the patch
To apply individual patches, use the following links depending on your deployment method:
- ÃÛ¶¹ÊÓÆµ Commerce or Magento Open Source on-premises: Quality Patches Tool > Usage in the Quality Patches Tool guide.
- ÃÛ¶¹ÊÓÆµ Commerce on cloud infrastructure: Upgrades and Patches > Apply Patches in the Commerce on Cloud Infrastructure guide.
Related reading
To learn more about Quality Patches Tool, refer to:
- Quality Patches Tool: A self-service tool for quality patches in the Tools guide.