shlinkio / shlink-web-client

A React-based client application for Shlink
https://app.shlink.io
MIT License
288 stars 76 forks source link

Fix importing servers in Firefox for Android #1135

Closed acelaya closed 5 months ago

acelaya commented 5 months ago

Closes #1130

This PR changes the import servers file input from accept="text/csv" to "aceppt=".csv".

The reason is that, with the former, Firefox for Android would not allow picking valid CSV files if they have spaces in their name.

The solution is not perfect, as now Firefox for Android allows to pick any file, but that's because it does not really support the accept attribute in file inputs. See https://caniuse.com/?search=input%20type%20file%20accept

With this change, Chrome for Android also allows to pick any file, but that was already its behavior before.

On desktop browsers the filtering works as expected, with the only limitation that you no longer can pick CSV files that don't have the CSV extension, and you can pick non-CSV files if they have the csv extension. But those are probably edge cases.

In any cases, Shlink handles the parsing of the file and displays a proper error message if an invalid file is picked, so this should put us in a better situation.

github-actions[bot] commented 5 months ago

Preview environment

https://shlinkio.github.io/shlink-web-client/feature/fix-firefox-import/

codecov[bot] commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 85.59%. Comparing base (b399523) to head (0e0ea3f). Report is 1 commits behind head on develop.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #1135 +/- ## ======================================== Coverage 85.59% 85.59% ======================================== Files 55 55 Lines 2277 2277 Branches 306 306 ======================================== Hits 1949 1949 Misses 23 23 Partials 305 305 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.