diff --git a/src/pages/download.tsx b/src/pages/download.tsx index f10fec4..3cdc01e 100644 --- a/src/pages/download.tsx +++ b/src/pages/download.tsx @@ -24,7 +24,7 @@ export const download = new Elysia() const jobId = decodeURIComponent(params.jobId); const fileName = sanitize(decodeURIComponent(params.fileName)); - const filePath = `${outputDir}${userId}/${jobId}/${fileName}`; + const filePath = `${outputDir}${userId}/${sanitize(jobId)}/${fileName}`; return Bun.file(filePath); }, { diff --git a/src/pages/upload.tsx b/src/pages/upload.tsx index 0c00009..f7cb9bc 100644 --- a/src/pages/upload.tsx +++ b/src/pages/upload.tsx @@ -25,12 +25,12 @@ export const upload = new Elysia().use(userService).post( if (body?.file) { if (Array.isArray(body.file)) { for (const file of body.file) { - const santizedFileName = sanitize(file.name); - await Bun.write(`${userUploadsDir}${santizedFileName}`, file); + const sanitizedFileName = sanitize(file.name); + await Bun.write(`${userUploadsDir}${sanitizedFileName}`, file); } } else { - const santizedFileName = sanitize(body.file["name"]); - await Bun.write(`${userUploadsDir}${santizedFileName}`, body.file); + const sanitizedFileName = sanitize(body.file["name"]); + await Bun.write(`${userUploadsDir}${sanitizedFileName}`, body.file); } }