From d57d5e983d8053c66c1c63133cadf0ff06a8dce2 Mon Sep 17 00:00:00 2001 From: Lost Paul <70213368+LostPaul@users.noreply.github.com> Date: Sat, 12 Aug 2023 23:25:40 +0200 Subject: [PATCH] Fix vault overview --- manifest.json | 2 +- src/folderOverview/FolderOverview.ts | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/manifest.json b/manifest.json index 0751f12..c784bf4 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "folder-notes", "name": "Folder notes", - "version": "1.5.5", + "version": "1.5.6", "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/folderOverview/FolderOverview.ts b/src/folderOverview/FolderOverview.ts index ae5749a..b2d59f0 100644 --- a/src/folderOverview/FolderOverview.ts +++ b/src/folderOverview/FolderOverview.ts @@ -68,7 +68,7 @@ export class FolderOverview { let files: TAbstractFile[] = []; const sourceFile = plugin.app.vault.getAbstractFileByPath(ctx.sourcePath); if (!sourceFile) return; - const sourceFolderPath = this.yaml.folderPath || plugin.getFolderPathFromString(ctx.sourcePath); + let sourceFolderPath = this.yaml.folderPath || plugin.getFolderPathFromString(ctx.sourcePath); let sourceFolder: TFolder | undefined; if (sourceFolderPath !== '/') { if (this.yaml.folderPath === '') { @@ -86,7 +86,10 @@ export class FolderOverview { titleEl.innerText = this.yaml.title.replace('{{folderName}}', ''); } } - if (!sourceFolder && sourceFolderPath !== '/') { return new Notice('Couldn\'t find the folder'); } + if (!sourceFolder && (sourceFolderPath !== '/' && sourceFolderPath !== '')) { return new Notice('Couldn\'t find the folder'); } + if (!sourceFolder && sourceFolderPath == '') { + sourceFolderPath = '/'; + } if (sourceFolderPath == '/') { const rootFiles: TAbstractFile[] = []; plugin.app.vault.getAllLoadedFiles().filter(f => f.parent?.path === '/').forEach((file) => {