Skip to content

Commit

Permalink
Merge branch 'stable'
Browse files Browse the repository at this point in the history
  • Loading branch information
zadam committed Jan 10, 2024
2 parents dff4f73 + 390ad6d commit 2c7b774
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 13 deletions.
4 changes: 2 additions & 2 deletions libraries/ckeditor/ckeditor.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion libraries/ckeditor/ckeditor.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/services/keyboard_actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ const DEFAULT_KEYBOARD_ACTIONS = [
},
{
actionName: "lastTab",
defaultShortcuts: ["CommandOrControl+0"],
defaultShortcuts: [],
description: "Activates the last tab in the list",
scope: "window"
},
Expand Down
10 changes: 5 additions & 5 deletions src/services/notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,8 @@ function findRelationMapLinks(content, foundLinks) {
const imageUrlToAttachmentIdMapping = {};

async function downloadImage(noteId, imageUrl) {
const unescapedUrl = utils.unescapeHtml(imageUrl);

try {
let imageBuffer;

Expand All @@ -487,10 +489,10 @@ async function downloadImage(noteId, imageUrl) {
});
});
} else {
imageBuffer = await request.getImage(imageUrl);
imageBuffer = await request.getImage(unescapedUrl);
}

const parsedUrl = url.parse(imageUrl);
const parsedUrl = url.parse(unescapedUrl);
const title = path.basename(parsedUrl.pathname);

const imageService = require('../services/image.js');
Expand Down Expand Up @@ -519,7 +521,7 @@ function downloadImages(noteId, content) {
let imageMatch;

while (imageMatch = imageRe.exec(content)) {
let url = imageMatch[1];
const url = imageMatch[1];
const inlineImageMatch = /^data:image\/[a-z]+;base64,/.exec(url);

if (inlineImageMatch) {
Expand All @@ -541,8 +543,6 @@ function downloadImages(noteId, content) {
continue;
}

url = utils.unescapeHtml(url);

if (url in imageUrlToAttachmentIdMapping) {
const attachment = becca.getAttachment(imageUrlToAttachmentIdMapping[url]);

Expand Down
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 2c7b774

Please sign in to comment.