Skip to content

Commit

Permalink
Update file.routes.ts
Browse files Browse the repository at this point in the history
Fix error code
  • Loading branch information
ginger51011 authored Aug 17, 2022
1 parent 49c067c commit 196f566
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/routes/file.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ filesRoute.post('/upload', upload(), verifyAuthenticated, async (req, res) => {
// Check file size (file.size is in bytes)
const maxSize = config.FILES.MAX_FILE_UPLOAD_SIZE_BYTES;
if (file.size > maxSize) {
return res.status(400).send(`File too big, max is ${maxSize / BYTES_PER_MB} MB`);
return res.status(413).send(`File too big, max is ${maxSize / BYTES_PER_MB} MB`);
}

const accessType = body?.accessType ?? AccessType.Public;
Expand All @@ -81,7 +81,7 @@ filesRoute.post('/upload/avatar', upload(), verifyAuthenticated, async (req, res
const maxSize = config.FILES.MAX_FILE_UPLOAD_SIZE_BYTES;
const sizeConstraint = Math.min(maxAvatarSize, maxSize);
if (file.size > sizeConstraint) {
return res.status(400).send(`Avatar too big, max is ${sizeConstraint / BYTES_PER_MB} MB`);
return res.status(413).send(`Avatar too big, max is ${sizeConstraint / BYTES_PER_MB} MB`);
}

const { user } = res.locals;
Expand Down

0 comments on commit 196f566

Please sign in to comment.