Description
Preconditions (*)
- Magento 2.4.3 CE
- Activate remote storage with AWS S3
Steps to reproduce (*)
- Use an image where the filename has an hyphen as a second character:
5-100.png
- Use a second image with the same first character, but an underscore as second:
5_100.png
- Synchronise remote storage with
bin/magento remote-storage:sync
Expected result (*)
- Both images will be synchronised with the remote storage.
Actual result (*)
- The first image (with dash) is being stored correctly.
- The second image fails with the message
Notice: Undefined index: media/catalog/product/5/_ in /src/vendor/magento/module-remote-storage/Driver/Adapter/Cache/Generic.php on line 197
- The sync process halts.
Technical background
The issue lies in RemoteStorage/Driver/Adapter/Cache/Generic
. The dashes are converted to underscore in the internal workings of the cache adapter (line 192). This causes that the underscore variant receives the cache that the dash variant has already created. However, the path inside the $meta
has been unaffected by the underscore conversion and the mismatch triggers the exceptions. This was very easily circumvented by the following change to check both non-empty content as well as existence, which prevents that the incorrect cache is being used for the underscore variant:
< if (!$meta[$path]) {
---
> if (empty($meta[$path])) {
Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.
Additional Info
[X] Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status