fixed path for images with unicode

This commit is contained in:
Gamosoft 2025-12-19 17:39:38 +01:00
parent f8b3617a9f
commit 1450a55683
1 changed files with 8 additions and 1 deletions

View File

@ -3801,7 +3801,14 @@ function noteApp() {
!src.startsWith('//') && !src.startsWith('/api/images/') &&
!src.startsWith('data:')) {
// URL-encode path segments to handle spaces and special characters
const encodedPath = src.split('/').map(segment => encodeURIComponent(segment)).join('/');
// Decode first to avoid double-encoding if path already contains %XX sequences
const encodedPath = src.split('/').map(segment => {
try {
return encodeURIComponent(decodeURIComponent(segment));
} catch (e) {
return encodeURIComponent(segment);
}
}).join('/');
img.setAttribute('src', `/api/images/${encodedPath}`);
}
}