Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: trying to load an image from not existing folder, breaks the presentation #88

Merged
merged 3 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- Trying to load an image from an not existing folder, breaks the presentation (https://github.com/JankariTech/web-app-presentation-viewer/issues/86)
- Single backtick is not recognizable as code block (https://github.com/JankariTech/web-app-presentation-viewer/pull/82)
- Code blocks in lists are not using existing space (https://github.com/JankariTech/web-app-presentation-viewer/pull/80)

Expand Down
5 changes: 5 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ async function getSubMediaFile(path: string): Promise<Resource> {
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
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/App.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions tests/unit/__snapshots__/App.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ exports[`App component > render markdown slides 1`] = `
<p><img src="blob:nodedata:0295bafb-5976-468a-a263-685a8872cb96" alt="cool"></p>
<p><img src="./non-existing-image.png" alt="non-existing"></p>
<p><img src="blob:nodedata:0295bafb-5976-468a-a263-685a8872cb96" alt="sub-folder-image"></p>
<p><img src="./non-existing/another-cool.jpg" alt="sub-folder-image"></p>
</section>
<section data-markdown="" data-markdown-parsed="true" style="top: 350px; display: none;" hidden="" aria-hidden="true" class="future">
<h3 id="code-block">Code block</h3>
Expand Down