diff --git a/apps/web/next.config.ts b/apps/web/next.config.ts index fa64f62..3a8a913 100644 --- a/apps/web/next.config.ts +++ b/apps/web/next.config.ts @@ -16,6 +16,17 @@ const nextConfig: NextConfig = { ], }, serverExternalPackages: [], + experimental: { + serverActions: { + bodySizeLimit: "1pb", + }, + }, + api: { + bodyParser: { + sizeLimit: "1pb", + }, + responseLimit: false, + }, }; const withNextIntl = createNextIntlPlugin(); diff --git a/apps/web/src/app/api/(proxy)/filesystem/download/[token]/route.ts b/apps/web/src/app/api/(proxy)/filesystem/download/[token]/route.ts index f462faa..aa108f2 100644 --- a/apps/web/src/app/api/(proxy)/filesystem/download/[token]/route.ts +++ b/apps/web/src/app/api/(proxy)/filesystem/download/[token]/route.ts @@ -18,8 +18,7 @@ export async function GET(req: NextRequest, { params }: { params: Promise<{ toke const contentDisposition = apiRes.headers.get("Content-Disposition"); const contentLength = apiRes.headers.get("Content-Length"); - const resBody = await apiRes.arrayBuffer(); - const res = new NextResponse(resBody, { + const res = new NextResponse(apiRes.body, { status: apiRes.status, headers: { "Content-Type": contentType, diff --git a/apps/web/src/app/api/(proxy)/filesystem/upload/[token]/route.ts b/apps/web/src/app/api/(proxy)/filesystem/upload/[token]/route.ts index f8260fe..fdfb0e8 100644 --- a/apps/web/src/app/api/(proxy)/filesystem/upload/[token]/route.ts +++ b/apps/web/src/app/api/(proxy)/filesystem/upload/[token]/route.ts @@ -8,7 +8,6 @@ const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; export async function PUT(req: NextRequest, { params }: { params: Promise<{ token: string }> }) { const { token } = await params; const cookieHeader = req.headers.get("cookie"); - const body = await req.arrayBuffer(); const url = `${API_BASE_URL}/filesystem/upload/${token}`; const apiRes = await fetch(url, { @@ -16,10 +15,11 @@ export async function PUT(req: NextRequest, { params }: { params: Promise<{ toke headers: { cookie: cookieHeader || "", "Content-Type": req.headers.get("Content-Type") || "application/octet-stream", - "Content-Length": req.headers.get("Content-Length") || body.byteLength.toString(), + "Content-Length": req.headers.get("Content-Length") || "0", }, - body: body, - }); + body: req.body, + duplex: "half", + } as RequestInit); const contentType = apiRes.headers.get("Content-Type") || "application/json";