When using shopware-clito push plugin information, and defining image filenames as numbers (e.g., 4, 5, 6, 7, 8, 9, 10) in The preview image is not selected as expected. The image with the name "10" is not being set as the preview image. This appears to be due to alphabetical sorting in Golang's os.ReadDir(directory) method, where "10" is treated as coming before "2", leading to incorrect image ordering.
Expected behaviour
The preview image should be the highest-numbered file in the sequence (e.g., "10" should be selected over "1"). Filenames should be sorted numerically rather than alphabetically.
Steps to Reproduce?
In the .shopware.extension.yml file, define image files with numeric names (e.g., 4, 5, 6, 7, 8, 9, 10).
Use shopware-cli to push plugin information.
Observe that "10" is not selected as the preview image due to alphabetical sorting of the files.
PHP Version
No response
Shopware Version
No response
Plugin Version
No response
Actual behaviour
When using
shopware-cli
to push plugin information, and defining image filenames as numbers (e.g., 4, 5, 6, 7, 8, 9, 10) in The preview image is not selected as expected. The image with the name "10" is not being set as the preview image. This appears to be due to alphabetical sorting in Golang'sos.ReadDir(directory)
method, where "10" is treated as coming before "2", leading to incorrect image ordering.Expected behaviour
The preview image should be the highest-numbered file in the sequence (e.g., "10" should be selected over "1"). Filenames should be sorted numerically rather than alphabetically.
Steps to Reproduce?
.shopware.extension.yml
file, define image files with numeric names (e.g., 4, 5, 6, 7, 8, 9, 10).shopware-cli
to push plugin information.