Server: Fixes #15395: Static asset resolution fails on Windows due to backslash path separators (#15396)

This commit is contained in:
Aissa Benfodda authored and GitHub committed 2026-05-13 10:15:43 +01:00
1 parent 9fc2d76fa3
commit ee89ae602b
1 file changed
+2 -1
+2 -1
View File
@@ -9,6 +9,7 @@ import { localFileFromUrl } from '../utils/joplinUtils';
import { homeUrl, loginUrl } from '../utils/urlUtils';
import * as mime from '@joplin/lib/mime-utils';
import { hasOwnProperty } from '@joplin/utils/object';
import { toForwardSlashes } from '@joplin/utils/path';
const publicDir = `${dirname(dirname(__dirname))}/public`;
@@ -34,7 +35,7 @@ async function findLocalFile(path: string): Promise<string> {
const appFilePath = await localFileFromUrl(path);
if (appFilePath) return appFilePath;
let localPath = normalize(path);
let localPath = toForwardSlashes(normalize(path));
if (localPath.indexOf('..') >= 0) throw new ErrorNotFound(`Cannot resolve path: ${path}`);
if (hasOwnProperty(pathToFileMap, path)) return pathToFileMap[path];