FriendsOfShopware / shopware-cli

CLI for Shopware Account and Shopware 6
MIT License
81 stars 32 forks source link

Incorrect Preview Image Selection Due to Alphabetical Sorting #409

Closed umitcekirge closed 3 days ago

umitcekirge commented 1 month ago

PHP Version

No response

Shopware Version

No response

Plugin Version

No response

Actual behaviour

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?

shyim commented 3 days ago

I think I would document this behavior. I don't really want to adjust something in file sorting 🤔.