Skip to content

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

@legibe-com

Description

@legibe-com

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions