Skip to content

Commit

Permalink
Merge pull request #88 from JankariTech/fix/issues-86
Browse files Browse the repository at this point in the history
fix: trying to load an image from not existing folder, breaks the presentation
  • Loading branch information
saw-jan authored Sep 30, 2024
2 parents 79e6276 + a15d18f commit 289ffa8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
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

0 comments on commit 289ffa8

Please sign in to comment.