Skip to content

Commit

Permalink
#7 Case Insensitive Image Extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
Ozan Tellioglu committed Nov 2, 2021
1 parent 6ebc6bd commit b27d919
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> = new Set(['jpeg', 'jpg', 'png', 'gif', 'svg', 'bmp']);

// Create the List of Unused Images
Expand All @@ -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]);
}
}
Expand Down

0 comments on commit b27d919

Please sign in to comment.