mirror of
https://github.com/bewcloud/bewcloud.git
synced 2026-03-11 08:54:49 +00:00
Windows path bugfix
This commit is contained in:
parent
5e913dd9d5
commit
ee7a5ba82b
1 changed files with 5 additions and 1 deletions
|
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue