From ad251a768223b8549c54989cfcb61c6e922f383f Mon Sep 17 00:00:00 2001 From: linyuchen Date: Sun, 5 May 2024 20:05:52 +0800 Subject: [PATCH] fix: http download filename special character --- src/common/utils/file.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/common/utils/file.ts b/src/common/utils/file.ts index 94328e42..e019d9ee 100644 --- a/src/common/utils/file.ts +++ b/src/common/utils/file.ts @@ -193,6 +193,7 @@ export async function uri2local(uri: string, fileName: string | null = null): Pr // res.ext = pathInfo.ext } } + fileName = fileName.replace(/[/\\:*?"<>|]/g, '_'); res.fileName = fileName; filePath = path.join(getTempDir(), uuidv4() + fileName); fs.writeFileSync(filePath, buffer);