Closed blamoo closed 4 months ago
I'm having a problem with a zip file with entries poorly named as numbers without leading zeroes (1.jpg, 2.jpg, [...] , 10.jpg, 11.jpg, etc).
I can force these entries to be in right order when creating the zip file but the library sorts them by name after reading the zip file:
https://github.com/klauspost/compress/blob/8bd3916ec655c728bb368f27772429d0704d7785/zip/reader.go#L782-L784
Is there any reason to forcibly sort them alphabetically like this?
The list is only sorted when you call Reader.Open. It is used for faster random access to files.
If you use the Reader.File slice it will remain unsorted. So use that instead of the fs.Fs interface.
I'm having a problem with a zip file with entries poorly named as numbers without leading zeroes (1.jpg, 2.jpg, [...] , 10.jpg, 11.jpg, etc).
I can force these entries to be in right order when creating the zip file but the library sorts them by name after reading the zip file:
https://github.com/klauspost/compress/blob/8bd3916ec655c728bb368f27772429d0704d7785/zip/reader.go#L782-L784
Is there any reason to forcibly sort them alphabetically like this?