From f301478535ead6489eba4ed3f6e2ddca119538d9 Mon Sep 17 00:00:00 2001 From: Lost Paul <70213368+LostPaul@users.noreply.github.com> Date: Sun, 6 Aug 2023 17:20:03 +0200 Subject: [PATCH] Fixed * pattern bug for excluding folders from the overview --- manifest.json | 2 +- src/excludedFolder.ts | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest.json b/manifest.json index bdbf6e0..5590101 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "folder-notes", "name": "Folder notes", - "version": "1.4.7", + "version": "1.4.8", "minAppVersion": "0.15.0", "description": "Create notes within folders that can be accessed without collapsing the folder, similar to the functionality offered in Notion.", "author": "Lost Paul", diff --git a/src/excludedFolder.ts b/src/excludedFolder.ts index 1cab245..690fee1 100644 --- a/src/excludedFolder.ts +++ b/src/excludedFolder.ts @@ -68,24 +68,24 @@ export function getExcludedFolderByPattern(plugin: FolderNotesPlugin, folderName return plugin.settings.excludeFolders.filter((s) => s.type == 'pattern').find((pattern) => { if (!pattern.string) { return false; } const string = pattern.string.toLocaleLowerCase().trim(); - if (!string.startsWith('{regex}') || string.startsWith('*') || string.endsWith('*')) { return false; } + if (!string.startsWith('{regex}') && !(string.startsWith('*') || string.endsWith('*'))) { return false; } const regex = string.replace('{regex}', '').trim(); if (string.startsWith('{regex}') && regex === '') { return false; } - if (regex !== undefined) { + if (regex !== undefined && string.startsWith('{regex}')) { const match = new RegExp(regex).exec(folderName); if (match) { return true; } - } else if (pattern.string.startsWith('*') && pattern.string.endsWith('*')) { - if (folderName.includes(pattern.string.slice(1, -1))) { + } else if (string.startsWith('*') && string.endsWith('*')) { + if (folderName.includes(string.slice(1, -1))) { return true; } - } else if (pattern.string.startsWith('*')) { - if (folderName.endsWith(pattern.string.slice(1))) { + } else if (string.startsWith('*')) { + if (folderName.endsWith(string.slice(1))) { return true; } - } else if (pattern.string.endsWith('*')) { - if (folderName.startsWith(pattern.string.slice(0, -1))) { + } else if (string.endsWith('*')) { + if (folderName.startsWith(string.slice(0, -1))) { return true; } }