Merge branch 'stable'

This commit is contained in:
zadam 2024-01-10 22:57:05 +01:00
commit 2c7b774356
7 changed files with 17 additions and 13 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "trilium",
"version": "0.62.4",
"version": "0.62.5",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "trilium",
"version": "0.62.4",
"version": "0.62.5",
"hasInstallScript": true,
"license": "AGPL-3.0-only",
"dependencies": {

View File

@ -302,7 +302,7 @@ const DEFAULT_KEYBOARD_ACTIONS = [
},
{
actionName: "lastTab",
defaultShortcuts: ["CommandOrControl+0"],
defaultShortcuts: [],
description: "Activates the last tab in the list",
scope: "window"
},

View File

@ -471,6 +471,8 @@ function findRelationMapLinks(content, foundLinks) {
const imageUrlToAttachmentIdMapping = {};
async function downloadImage(noteId, imageUrl) {
const unescapedUrl = utils.unescapeHtml(imageUrl);
try {
let imageBuffer;
@ -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');
@ -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) {
@ -541,8 +543,6 @@ function downloadImages(noteId, content) {
continue;
}
url = utils.unescapeHtml(url);
if (url in imageUrlToAttachmentIdMapping) {
const attachment = becca.getAttachment(imageUrlToAttachmentIdMapping[url]);

View File

@ -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>
@ -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) {

View File

@ -490,6 +490,10 @@ class SNote extends AbstractShacaEntity {
return escape(this.title);
}
get encodedTitle() {
return encodeURIComponent(this.title);
}
getPojo() {
return {
noteId: this.noteId,