Skip to content

Commit

Permalink
fix rendering image title in share renderer, closes #4578
Browse files Browse the repository at this point in the history
  • Loading branch information
zadam committed Jan 9, 2024
1 parent 77800d0 commit 390ad6d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/share/content_renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function renderCode(result) {

function renderMermaid(result, note) {
result.content = `
<img src="api/images/${note.noteId}/${note.escapedTitle}?${note.utcDateModified}">
<img src="api/images/${note.noteId}/${note.encodedTitle}?${note.utcDateModified}">
<hr>
<details>
<summary>Chart source</summary>
Expand All @@ -146,7 +146,7 @@ function renderMermaid(result, note) {
}

function renderImage(result, note) {
result.content = `<img src="api/images/${note.noteId}/${note.escapedTitle}?${note.utcDateModified}">`;
result.content = `<img src="api/images/${note.noteId}/${note.encodedTitle}?${note.utcDateModified}">`;
}

function renderFile(note, result) {
Expand Down
4 changes: 4 additions & 0 deletions src/share/shaca/entities/snote.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,10 @@ class SNote extends AbstractShacaEntity {
return escape(this.title);
}

get encodedTitle() {
return encodeURIComponent(this.title);
}

getPojo() {
return {
noteId: this.noteId,
Expand Down

0 comments on commit 390ad6d

Please sign in to comment.