Skip to content

Image resize queue error due to .tmp file handling when deleting unsaved product images #39146

Open
@kapilpandya2203

Description

@kapilpandya2203

Preconditions (*)

  1. Magento 2.4.6-p4
  2. Magento 2.4.7
  3. Magento Developer branch
  4. Indexer mode: Update by schedule

Description (*)

When we upload an image to the product and without saving the product again we delete the image and then we save the product, the image is added for resize in queue. And the error of system message is shown with failure of queue message.

Screenshot 1:
s1

Screenshot 2:
s6

Screenshot 3:
s5

Steps to reproduce (*)

  1. Access magento admin panel and set the indexer mode to Update by Schedule
  2. Go to Catalog->Product.
  3. Create a product or edit any existing product and upload a image and again remove the uploaded image without saving the product.
  4. Then save the product.
  5. Run media.storage.catalog.image.resize consumer

Expected result (*)

As the image was not saved to the product, hence the image should not be added to the queue for image resize.

Actual result (*)

As the image was not saved to the product, but the image is getting added to the queue for image resize.

Additional information (*)

When we upload the image, a copy of the image is created in tmp folder. And when we remove the image without saving the product the image in the tmp folder is not removed and hence the path of the image is sent to the Image resize queue due to which the consumer is not able to locate the .tmp image file in pub/media/catalog/product path as the .tmp image never existed in the given path.
Hence, it results into the failure of queue and it throws a system message.

Files:

  1. magento/module-catalog/Controller/Adminhtml/Product/Gallery/Upload.php
  2. magento/module-catalog/Observer/ImageResizeAfterProductSave.php
  3. magento/module-media-storage/Service/ImageResize.php

Upload controller is called when we upload a image and it sets the response and send it to the ImageResizeAfterProductSave observer in which the image file name is sent to the queue using ImageResize.
Even if we remove the product image right after uploading it and without saving the product, Upload controller still send the image path with .tmp extension to the observer and from there it goes to queue which fails afterwards.

Screenshot 4:
s4

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: ContentComponent: ImageIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: ready for devReported on 2.4.7Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions