filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
19.29k stars 2.96k forks source link

CSV File Upload on Firefox #10553

Closed salvobee closed 10 months ago

salvobee commented 10 months ago

Package

filament/filament

Package Version

v3.1.29

Laravel Version

v10.39.0

Livewire Version

v3.3.3

PHP Version

PHP 8.2.13

Problem description

I have encountered an issue related to the default action for importing records via CSV file upload.

When attempting to upload a CSV file using Firefox on Windows, I encountered a problem with the accepted MIME types by the form. The form indicated that it expected either "text/plain" or "text/csv." I attempted to create the CSV file by manually assembling some lines with Notepad++ and saving the file as plain text with a .csv extension. Additionally, I exported a file from Excel using the CSV format. However, regardless of these efforts, I was unable to upload any CSV file.

Upon further investigation, I used JavaScript to check the detected file type by my browser (Firefox) for these created files. Surprisingly, it was identified as "application/vnd.ms-excel." In contrast, Chrome detected them as "text/csv."

I delved into this issue and discovered that Firefox relies on the system registry to determine MIME types. I found a relevant discussion on the Mozilla support forum: Mozilla Support Forum.

I understand that this behavior might be influenced by how my system is configured to handle these types of files. However, I believe it is important to highlight that users of an application utilizing this functionality may encounter difficulties uploading files. Therefore, it would be beneficial to explore a solution to handle this use case effectively.

Expected behavior

The file upload should accept CSV files regardless of the system's MIME type detection, ensuring a smoother user experience across different browsers and configurations.

Steps to reproduce

Reproduction repository

https://github.com/filamentphp/filament/

Relevant log output

No response

github-actions[bot] commented 10 months ago

Hey @salvobee! We're sorry to hear that you've hit this issue. 💛

However, it looks like you forgot to fill in the reproduction repository URL. Can you edit your original post and then we'll look at your issue?

We need a public GitHub repository which contains a Laravel app with the minimal amount of Filament code to reproduce the problem. Please do not link to your actual project, what we need instead is a minimal reproduction in a fresh project without any unnecessary code. This means it doesn't matter if your real project is private / confidential, since we want a link to a separate, isolated reproduction. That would allow us to download it and review your bug much easier, so it can be fixed quicker. Please make sure to include a database seeder with everything we need to set the app up quickly.