From 8addd633b0fad5d3e857c1da6e4a65a739a79901 Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Mon, 30 Sep 2024 11:58:31 +0545 Subject: [PATCH 1/3] fix: trying to load an image from an not existing folder, breaks the presentation --- src/App.vue | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/App.vue b/src/App.vue index 41143a6..f3effbb 100644 --- a/src/App.vue +++ b/src/App.vue @@ -175,6 +175,11 @@ async function getSubMediaFile(path: string): Promise { let currentFiles = unref(activeFiles) for (const parent of parents) { const file = findFile(parent, currentFiles) + // return if the parent folder is not found + if (!file) { + return + } + const { children } = await webdav.listFiles(unref(currentFileContext).space, { path: file.path, fileId: file.fileId From 76a214bdc3907b3552e84a115f52ba4db7089079 Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Mon, 30 Sep 2024 11:58:54 +0545 Subject: [PATCH 2/3] test: add unit test for non-existing sub-folder --- tests/unit/App.spec.ts | 2 ++ tests/unit/__snapshots__/App.spec.ts.snap | 1 + 2 files changed, 3 insertions(+) diff --git a/tests/unit/App.spec.ts b/tests/unit/App.spec.ts index 147e43a..b39d0c3 100644 --- a/tests/unit/App.spec.ts +++ b/tests/unit/App.spec.ts @@ -76,6 +76,8 @@ Ordered list: ![non-existing](./non-existing-image.png) ![sub-folder-image](./sub/another-cool.jpg) + +![sub-folder-image](./non-existing/another-cool.jpg) --- ### Code block diff --git a/tests/unit/__snapshots__/App.spec.ts.snap b/tests/unit/__snapshots__/App.spec.ts.snap index cccdd97..ab72619 100644 --- a/tests/unit/__snapshots__/App.spec.ts.snap +++ b/tests/unit/__snapshots__/App.spec.ts.snap @@ -46,6 +46,7 @@ exports[`App component > render markdown slides 1`] = `

cool

non-existing

sub-folder-image

+

sub-folder-image