BlazorFileUpload icon indicating copy to clipboard operation
BlazorFileUpload copied to clipboard

Make allowed types case insensitive

Open zoinkydoink opened this issue 4 years ago • 3 comments

currently if i set the file types to .png;.jpg and i upload a .JPG it seems to fail because its not the correct type, just need to make this so it doesnt check the case sensitivity

zoinkydoink avatar Mar 06 '20 14:03 zoinkydoink

Ok, that makes sense. I will do a ToLower() on the comparision.

Thanks for testing and finding this. I tend to use the 'Works for me' model of testing.

DataJuggler avatar Mar 06 '20 14:03 DataJuggler

.Equals would work better and pass string compare with insensitivity

zoinkydoink avatar Mar 06 '20 14:03 zoinkydoink

I just published an update and checked in the I hope fixes this.

I could rewrite this if need be, but I noticed the allowed extensions was already set to lowercase, the issue I fixed was if the uploaded file.extension is .JPG or .PNG, I did a ToLower(), because I had written a contains method originally, so I didn't have to loop through each allowed extension.

I also abort now if the file does not have an extension, and allowed extensions is true and has at least one extension set.

I don't build rockets for this very reason, but 'I think it will work' without testing.

I am going for a run now. If this doesn't fix it I will rewrite it with an equals comparison for each extension.

DataJuggler avatar Mar 06 '20 16:03 DataJuggler