Skip to content

Commit

Permalink
fix(bigFile): write error
Browse files Browse the repository at this point in the history
  • Loading branch information
ido-pluto committed Jul 26, 2024
1 parent 1b1b578 commit a04bef8
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export async function loadUploadFiles(astro: AstroGlobal, options: Partial<LoadU
await fsExtra.ensureDir(uploadDir);

const sendError = async (errorMessage: string) => {
await fsExtra.emptyDir(uploadDir);
await fs.writeFile(path.join(uploadDir, 'error.txt'), errorMessage);
return Response.json({ ok: false, error: errorMessage });
};
Expand All @@ -90,7 +91,6 @@ export async function loadUploadFiles(astro: AstroGlobal, options: Partial<LoadU

const newTotalSize = (await totalDirectorySize(tempDirectory)) + uploadSize;
if (newTotalSize > maxUploadSize) {
await fsExtra.remove(uploadDir);
return await sendError("Upload size exceeded");
}

Expand Down

0 comments on commit a04bef8

Please sign in to comment.