Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect Preview Image Selection Due to Alphabetical Sorting #409

Open
umitcekirge opened this issue Sep 13, 2024 · 0 comments
Open

Incorrect Preview Image Selection Due to Alphabetical Sorting #409

umitcekirge opened this issue Sep 13, 2024 · 0 comments

Comments

@umitcekirge
Copy link

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'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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant