#38015·magento2

Some Files Disappeared After Deleting a Folder in Media Gallery

Author: suganu25Created Sep 28, 2023Updated Sep 28, 2026
LabelsIssue: ConfirmedComponent: MediaGalleryReproduced on 2.4.xPriority: P2Area: Content / CMSReported on 2.4.4

Preconditions

  1. Magento OpenSource 2.4.4/2.4.3

Steps to reproduce

  1. Login the Magento Back Office.
  2. Create two folders with matching prefixes on the same path in Media Gallery, for example, one named “abc” and the other “abc123”. These two folders are in the “category” folder.
  3. Upload some files into both folders.
  4. Delete the “abc” folder using the delete button in Media Gallery.

Expected result

  1. The “abc” folder has been deleted.
  2. The “abc123” folder has not been deleted.
  3. All files in the “abc123” folder can be found.

Actual result

  1. The “abc” folder has been deleted (this is the same as the expected result above).
  2. The “abc123” folder has not been deleted (this is the same as the expected result above).
  3. All files in the “abc123” folder cannot be found.
  4. However, all files in the “abc123” folder have not actually been deleted, and we were able to make the files appear after running the command “php bin/magento media-gallery:sync”.

If someone knows how to avoid the problem, please let me know it.