Skip to content

Media gallery displays incorrect images from directories with identical names but different case #39382

Open
@bhushan-cs

Description

@bhushan-cs

Preconditions and environment

  1. Magento 2.4.7

Steps to reproduce

  1. Create folder "Testing"
  2. Upload file "logo.png" to "Testing" folder
  3. Create folder "testing"
  4. "logo.png" file will show in "testing" folder

Expected result

When a file is uploaded to a specific directory, it should only be accessible within that directory. In this case, the "logo.png" file should be exclusively visible within the "Testing" directory.

Actual result

The "logo.png" file is incorrectly displayed within the "testing" directory as well, despite the difference in case. This behavior is unexpected and inconsistent with standard file system behavior.

Additional information

The SQL request that displays the files in media gallery is case insensitive.
Modifying collection query at Magento\MediaGalleryUi\Model\SearchCriteria\CollectionProcessor\FilterProcessor\Directory
$collection->getSelect()->where('path REGEXP ? ', '^' . $value . '/[^\/]*$');
to
$collection->getSelect()->where('BINARY path REGEXP ? ', '^' . $value . '/[^\/]*$');
should fix the issue.

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

Labels

Area: ContentComponent: MediaGalleryIssue: 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: PR in progressReported 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