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

Support for file extensions using uppercase letters #251

Open
cbdavis opened this issue Jan 13, 2020 · 5 comments
Open

Support for file extensions using uppercase letters #251

cbdavis opened this issue Jan 13, 2020 · 5 comments

Comments

@cbdavis
Copy link

cbdavis commented Jan 13, 2020

I'm running into problems when trying to read Excel files with uppercase extensions:

filename = "test.XLS"
df = DataFrame(load(filename, "Sheet1"))

Leads to

ERROR: NoDecodeDelegateForThisImageFormat `XLS' @ error/constitute.c/ReadImage/560

When I rename the file to test.xls everything works fine.

I'm also able to get things to work by changing the code here:

add_format(format"Excel", (), [".xls", ".xlsx"], [:ExcelFiles])

to:

add_format(format"Excel", (), [".xls", ".xlsx", ".XLS", ".XLSX"], [:ExcelFiles])

I see that a few formats have definitions for upper and lowercase variants of the file extensions, although it seems like it would be more ideal to just convert the extension string to lower case when trying to figure out which format the file is in.

This might be related to #236

@SimonDanisch
Copy link
Member

I find it bad style to support uppercase and lowercase extensions, which probably only a few extension vendors started doing. So I'm in favor of keeping this explicit for the few formats, that started allowing the uppercase version...

@oxinabox
Copy link
Contributor

oxinabox commented Mar 17, 2021

I don't think I agree. or at least not entirely.
File format when recogizing by extension (rather than magic byte) should be done in a case-insensitive way.
E.g. convert all of them to lower case before comparing.

Remembing that Windows historically uses a a case-insesitive file-system;
and also historically depended a lot more on the extension to decide what to do with a file.
In contrast to Unixen which has things like the shebang line to specfy interpretter.

I think it would be very weird to have a file extension that has to be in upper-case as the one way it is distinguished from another, simply because that wouldn't work in Windows.

@JohannesNE
Copy link

I ran into this issue with RData.jl. It not obvious to me (a Julia beginner) that capitalization of the file extension was the problem. I filed an issue at RData.jl (JuliaData/RData.jl#91).

@nalimilan
Copy link
Member

This has been reported again in RData. This might be a relatively exceptional case, but both "RData" and "Rdata" are widely used. FileIO already accepts both "RData" and "rdata", I guess we could add "Rdata" to the list but having something more systematic would be nice.

@nalimilan
Copy link
Member

BTW, we already support both "jpg" and "JPG", .stl" and ".STL", ".fit" and ".FIT", ".fits" and ".FITS", ".fts" and ".FTS", ".mid" and ".MID", so it seems to me that case sensitivity really doesn't make sense in practice.

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

5 participants