Add streaming bulk ENEX migration tool and normalize attachment paths
This commit is contained in:
1 parent
31b674bf01
commit
e74d1ad57b
2 files changed
+632
-1
No files matched your search
+2
-1
@@ -54,7 +54,8 @@ export async function saveAttachmentBuffer(
|
||||
|
||||
export function getFullAttachmentPath(storagePath: string): string {
|
||||
const baseDir = getAttachmentsDir();
|
||||
const resolved = path.resolve(baseDir, storagePath);
|
||||
const normalizedStoragePath = storagePath.replace(/\\/g, '/');
|
||||
const resolved = path.resolve(baseDir, normalizedStoragePath);
|
||||
if (!resolved.startsWith(path.resolve(baseDir))) {
|
||||
throw new Error('Invalid storage path');
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user