Skip to content

Commit

Permalink
πŸ› POST μš”μ²­μ˜ 파일 크기 μ œν•œ μΆ”κ°€ 및 νƒ€μž„μ•„μ›ƒ μ„€μ •
Browse files Browse the repository at this point in the history
  • Loading branch information
jihun-io committed Dec 13, 2024
1 parent 44a8d82 commit 0c8c102
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/app/api/account/avatar/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ import sharp from "sharp";
import { v4 as uuidv4 } from "uuid";
import { NextResponse } from "next/server";

export const maxDuration = 60; // νƒ€μž„μ•„μ›ƒ μ„€μ • (초 λ‹¨μœ„)

export async function POST(request) {
const contentLength = request.headers.get("content-length");
if (contentLength && parseInt(contentLength) > 10 * 1024 * 1024) {
// 10MB
return NextResponse.json({ error: "File too large" }, { status: 413 });
}

try {
const headersList = headers();
const authorization = headersList.get("Authorization");
Expand Down Expand Up @@ -64,11 +72,3 @@ export async function POST(request) {
return NextResponse.json({ error: "Upload failed" }, { status: 500 });
}
}

export const config = {
api: {
bodyParser: {
sizeLimit: "10mb",
},
},
};

0 comments on commit 0c8c102

Please sign in to comment.