Merge 678424b2d2 into 1ba82cf1b2
This commit is contained in:
commit
2ef00dd9b6
2 changed files with 5 additions and 5 deletions
|
|
@ -24,7 +24,7 @@ export const download = new Elysia()
|
||||||
const jobId = decodeURIComponent(params.jobId);
|
const jobId = decodeURIComponent(params.jobId);
|
||||||
const fileName = sanitize(decodeURIComponent(params.fileName));
|
const fileName = sanitize(decodeURIComponent(params.fileName));
|
||||||
|
|
||||||
const filePath = `${outputDir}${userId}/${jobId}/${fileName}`;
|
const filePath = `${outputDir}${userId}/${sanitize(jobId)}/${fileName}`;
|
||||||
return Bun.file(filePath);
|
return Bun.file(filePath);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -25,12 +25,12 @@ export const upload = new Elysia().use(userService).post(
|
||||||
if (body?.file) {
|
if (body?.file) {
|
||||||
if (Array.isArray(body.file)) {
|
if (Array.isArray(body.file)) {
|
||||||
for (const file of body.file) {
|
for (const file of body.file) {
|
||||||
const santizedFileName = sanitize(file.name);
|
const sanitizedFileName = sanitize(file.name);
|
||||||
await Bun.write(`${userUploadsDir}${santizedFileName}`, file);
|
await Bun.write(`${userUploadsDir}${sanitizedFileName}`, file);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const santizedFileName = sanitize(body.file["name"]);
|
const sanitizedFileName = sanitize(body.file["name"]);
|
||||||
await Bun.write(`${userUploadsDir}${santizedFileName}`, body.file);
|
await Bun.write(`${userUploadsDir}${sanitizedFileName}`, body.file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue