From ee7a5ba82b193091b4982457cb17073812d798e4 Mon Sep 17 00:00:00 2001 From: Tilman Date: Wed, 1 Oct 2025 21:30:45 +0200 Subject: [PATCH] Windows path bugfix --- lib/models/files.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/models/files.ts b/lib/models/files.ts index f8de55a..b068f6c 100644 --- a/lib/models/files.ts +++ b/lib/models/files.ts @@ -598,7 +598,11 @@ export async function ensureUserPathIsValidAndSecurelyAccessible(userId: string, const resolvedFullPath = `${resolve(fullPath)}/`; - if (!resolvedFullPath.startsWith(userRootPath)) { + // Normalize path separators for consistent comparison on Windows + const normalizedUserRootPath = userRootPath.replace(/\\/g, '/'); + const normalizedResolvedFullPath = resolvedFullPath.replace(/\\/g, '/'); + + if (!normalizedResolvedFullPath.startsWith(normalizedUserRootPath)) { throw new Error('Invalid file path'); } }