mother / react-files

A file input (dropzone) management component for React
MIT License
145 stars 35 forks source link

extension in uppercase #20

Closed flaviomariano closed 5 years ago

flaviomariano commented 6 years ago

Hi, i would like to be able to accept uppercased extensions, does it make sense to you? would it be possible to include this in the fileTypeAcceptable?

shearer12345 commented 6 years ago

To accept uppercase letters also, the regex at src/index.js#L5 could be changed to

const extRegexp = /\.[a-zA-Z0-9]*$/;

This matches lowercase a-z, uppercase A-Z, and 0-9.

I wonder if this could/should allow more characters? e.g. asdf.ééé - which is valid on most platforms (at least FAT32, NTFS, ext4). See https://en.wikipedia.org/wiki/Filename#Comparison_of_filename_limitations

Is line just trying to find that last part of the filename after the dot?

shearer12345 commented 6 years ago

I'm happy to make a PR for the above, or a variant of it.

asabhaney commented 6 years ago

Thanks, good catch @shearer12345! Yes, it's basically just to get the file extension following the dot. PRs welcome, but otherwise I'll try and update this as soon as I get a chance.

asabhaney commented 5 years ago

Fixed via #25