From b27d919b75f2ecae6f97bc7903538182489e8a3c Mon Sep 17 00:00:00 2001 From: Ozan Tellioglu Date: Tue, 2 Nov 2021 17:45:24 +0100 Subject: [PATCH] #7 Case Insensitive Image Extensions --- src/util.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util.ts b/src/util.ts index 638f941..5fa2853 100644 --- a/src/util.ts +++ b/src/util.ts @@ -3,7 +3,7 @@ import OzanClearImages from './main'; /* ------------------ Image Handlers ------------------ */ -const imageRegex = /.*(jpe?g|png|gif|svg|bmp)/; +const imageRegex = /.*(jpe?g|png|gif|svg|bmp)/i; const imageExtensions: Set = new Set(['jpeg', 'jpg', 'png', 'gif', 'svg', 'bmp']); // Create the List of Unused Images @@ -28,7 +28,7 @@ const getAllImagesInVault = (app: App): TFile[] => { let allFiles: TFile[] = app.vault.getFiles(); let images: TFile[] = []; for (let i = 0; i < allFiles.length; i++) { - if (imageExtensions.has(allFiles[i].extension)) { + if (imageExtensions.has(allFiles[i].extension.toLowerCase())) { images.push(allFiles[i]); } }