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", "name": "trilium",
"version": "0.62.4", "version": "0.62.5",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "trilium", "name": "trilium",
"version": "0.62.4", "version": "0.62.5",
"hasInstallScript": true, "hasInstallScript": true,
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
"dependencies": { "dependencies": {

View File

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

View File

@ -471,6 +471,8 @@ function findRelationMapLinks(content, foundLinks) {
const imageUrlToAttachmentIdMapping = {}; const imageUrlToAttachmentIdMapping = {};
async function downloadImage(noteId, imageUrl) { async function downloadImage(noteId, imageUrl) {
const unescapedUrl = utils.unescapeHtml(imageUrl);
try { try {
let imageBuffer; let imageBuffer;
@ -487,10 +489,10 @@ async function downloadImage(noteId, imageUrl) {
}); });
}); });
} else { } 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 title = path.basename(parsedUrl.pathname);
const imageService = require('../services/image.js'); const imageService = require('../services/image.js');
@ -519,7 +521,7 @@ function downloadImages(noteId, content) {
let imageMatch; let imageMatch;
while (imageMatch = imageRe.exec(content)) { while (imageMatch = imageRe.exec(content)) {
let url = imageMatch[1]; const url = imageMatch[1];
const inlineImageMatch = /^data:image\/[a-z]+;base64,/.exec(url); const inlineImageMatch = /^data:image\/[a-z]+;base64,/.exec(url);
if (inlineImageMatch) { if (inlineImageMatch) {
@ -541,8 +543,6 @@ function downloadImages(noteId, content) {
continue; continue;
} }
url = utils.unescapeHtml(url);
if (url in imageUrlToAttachmentIdMapping) { if (url in imageUrlToAttachmentIdMapping) {
const attachment = becca.getAttachment(imageUrlToAttachmentIdMapping[url]); const attachment = becca.getAttachment(imageUrlToAttachmentIdMapping[url]);

View File

@ -137,7 +137,7 @@ function renderCode(result) {
function renderMermaid(result, note) { function renderMermaid(result, note) {
result.content = ` result.content = `
<img src="api/images/${note.noteId}/${note.escapedTitle}?${note.utcDateModified}"> <img src="api/images/${note.noteId}/${note.encodedTitle}?${note.utcDateModified}">
<hr> <hr>
<details> <details>
<summary>Chart source</summary> <summary>Chart source</summary>
@ -146,7 +146,7 @@ function renderMermaid(result, note) {
} }
function renderImage(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) { function renderFile(note, result) {

View File

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