Previously a check could fail if, for example, “.png” is allowed but the uploaded file uses the uppercase “.PNG“ extension.
}
function validateFileExtension(element: WoltlabCoreFileUploadElement, file: File): boolean {
- const fileExtensions = (element.dataset.fileExtensions || "*").split(",");
+ const fileExtensions = (element.dataset.fileExtensions || "*").toLowerCase().split(",");
for (const fileExtension of fileExtensions) {
if (fileExtension === "*") {
return true;
- } else if (file.name.endsWith(fileExtension)) {
+ } else if (file.name.toLowerCase().endsWith(fileExtension)) {
return true;
}
}
return false;
}
function validateFileExtension(element, file) {
- const fileExtensions = (element.dataset.fileExtensions || "*").split(",");
+ const fileExtensions = (element.dataset.fileExtensions || "*").toLowerCase().split(",");
for (const fileExtension of fileExtensions) {
if (fileExtension === "*") {
return true;
}
- else if (file.name.endsWith(fileExtension)) {
+ else if (file.name.toLowerCase().endsWith(fileExtension)) {
return true;
}
}