From b67e735e046ce1f87cf728b36374d23bb961d809 Mon Sep 17 00:00:00 2001 From: maikrolf <40924921+maikrolf@users.noreply.github.com> Date: Sat, 19 Sep 2026 17:15:02 +0200 Subject: [PATCH] fix: local pin POST body lezing - lees als text voordat JSON parse --- src/app/api/[...path]/proxy-ipfs.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app/api/[...path]/proxy-ipfs.ts b/src/app/api/[...path]/proxy-ipfs.ts index 3c1d3cf..6ff4743 100644 --- a/src/app/api/[...path]/proxy-ipfs.ts +++ b/src/app/api/[...path]/proxy-ipfs.ts @@ -106,12 +106,15 @@ async function handleLocalPins(path: string, method: string, req: NextRequest): // POST /api/pins — pin een CID if (p === 'pins' && method === 'POST') { try { - const body = await req.json(); + // Lees body als text, dan parse als JSON (voorkomt "body already read" issues) + const text = await req.text(); + const body = text ? JSON.parse(text) : {}; const { cid, name, size } = body; if (!cid) return NextResponse.json({ error: 'cid required' }, { status: 400 }); await localAddPin(cid, name, size || 0); return NextResponse.json({ cid }); - } catch { + } catch (e) { + console.error('[handleLocalPins] POST error:', e); return NextResponse.json({ error: 'Invalid request' }, { status: 400 }); } }