It seems that a .csv file can have a text/csv, application/vnd.ms-excel or text/plain content type depending on the client's OS. As mentioned by @jessie19:
TL;DR On a Windows machine with Microsoft Excel installed, CSV files may have a MIME type of application/vnd.ms-excel rather than the RFC 4180 suggested type of text/csv. Symfony, in particular, will match that MIME type with an file extension of ‘xls’. That causes issues with file validation.
Hi,
Maintainer of active_storage_validations here 👋.
We are relying on the amazing
marcel
gem to do the heavy-lifting of mapping content types and extensions. However there seem to have an issue with thecsv
extension. Issue link => https://github.com/igorkasyanchuk/active_storage_validations/issues/291.It seems that a
.csv
file can have atext/csv
,application/vnd.ms-excel
ortext/plain
content type depending on the client's OS. As mentioned by @jessie19:source: https://christianwood.net/posts/csv-file-upload-validation/
I am unsure about what to do here, we could extend
marcel
with something like:But it could have side effects down the road, are you aware of this issue? @jeremy