Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Files with extensions in uppercase get a "Forbidden File Type" error #15

Open
legibe-com opened this issue Nov 30, 2022 · 1 comment

Comments

@legibe-com
Copy link

Hi!

Assuming the script is used with the 'fileType' parameter set as '.jpg,.jpeg,.gif,.png' like in the Sample file, when sending an image named, let's say, IMG_4567.JPG, the javascript will reject the file, applying the status "Forbidden File Type" to it.

To correct this, this part of the javascript file:

// Create an array of file types
var file_types;
if (settings.fileType) {
	file_types = settings.fileType.split(',');
}

Could simply be changed to:

// Create an array of file types
var file_types;
if (settings.fileType) {
	file_types = settings.fileType.split(',');
	file_types = $.merge( $.merge( [], file_types ), file_types.map(item => item.toUpperCase() ));
}

This way, files can be treated whether their name is "IMG_4567.jpg" or "IMG_4567.JPG".

That probably got forgotten on the way, as the equivalent is done in the PHP file, so there's no need to modify anything in it for the bug to be fixed.

@legibe-com legibe-com changed the title Improvement/bug: Allow file types in uppercase as well Bug: Files with extensions in uppercase get a "Forbidden File Type" error Dec 1, 2022
@LrntL
Copy link

LrntL commented Oct 12, 2023

Thanks for the quick fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants