Windows path bugfix

This commit is contained in:
Tilman 2025-10-01 21:30:45 +02:00
parent 5e913dd9d5
commit ee7a5ba82b

View file

@ -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');
}
}