Subject: | CSV file identified as C source code |
This is probably a problem with the underlying libmagic.so library, so it may not be best to solve it in File::LibMagic, but it might.
I have a case where an obviously comma separated values (.CSV) file that should have a mime-type of 'text/plain' or 'text/csv' is identified as a mime-type of 'text/x-c' (C source code).
I believe this happened because one of the lines in the file started with an email address that just happened to start with the C keyword 'char'. So with an email address 'charlie@example.com' as the first thing on any line triggered the identification as a C source code file. However, ' charlie@example.com' (first character is a space) or 'Charlie@example.com' (first character is upper-case C) did not. I didn't try all C keywords, but I did try 'int' and it didn't trigger the identification as a C source code file.
This is File::LibMagic version 1.12 running under Perl v5.20.3 on Ubuntu 14.04.5.
I thought this was kind of funny. We created a workaround so it's not a huge deal for us, but it really is a goofy bug.
Daina