Lowercase extension of item before comparing with valid imageTypes

This commit is contained in:
precondition
2024-01-30 01:04:54 +01:00
committed by GitHub
parent 692071eea0
commit 5bb2a4033a

View File

@@ -41,7 +41,8 @@
max = items.length; max = items.length;
for (const item of items) { for (const item of items) {
if (imageTypes.includes('.' + item.pathname.split('.').at(-1) || '')) { const itemFileExtension = ('.' + item.pathname.split('.').at(-1)).toLowerCase();
if (imageTypes.includes(itemFileExtension || '')) {
const image = await fetch(url + item.pathname); const image = await fetch(url + item.pathname);
const blob = await image.blob(); const blob = await image.blob();
const file = new File([blob], item.pathname.substring(1)); const file = new File([blob], item.pathname.substring(1));