tafia / calamine

A pure Rust Excel/OpenDocument SpreadSheets file reader: rust on metal sheets
MIT License
1.6k stars 155 forks source link

Use case-insensitive comparison to find a part file in Xlsx ZIP archive #419

Closed andy128k closed 2 months ago

andy128k commented 3 months ago

I have a file which calamine fails to open. It crashes with index out of bounds: the len is 0 but the index is 0 here. It happened that my file contains /xl/SharedStrings.xml (while [Content_Types].xml mentions /xl/sharedStrings.xml :facepalm:) and calamine expects /xl/sharedStrings.xml.

I did a quick search and it seems ECMA-376 assumes case-insensitive comparison of part names.

6.2.2.3 Part name equivalence and integrity in an abstract package

Equivalence of part names shall be determined by ASCII case-insensitive matching.

dimastbk commented 2 months ago

Maybe it should also be ported to xlsb?

tafia commented 2 months ago

Good point. Also can you add a test?