From 7a60f1777cead70905727ec5354a3631a4600695 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 4 May 2026 02:21:27 +0000 Subject: [PATCH] fix: keep upload pending until /confirm Single-PUT init was inserting rows with status='approved' (skipping the confirmation step), so a failed browser->R2 PUT left ghost entries that the gallery happily listed. Always start as 'pending'; the existing /confirm flow is the only place that should approve. https://claude.ai/code/session_01TPBqgcSJMppgrpiq7fLywL --- apps/api/src/routes/uploads.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/apps/api/src/routes/uploads.ts b/apps/api/src/routes/uploads.ts index dabc557..e11f37a 100644 --- a/apps/api/src/routes/uploads.ts +++ b/apps/api/src/routes/uploads.ts @@ -80,9 +80,6 @@ uploadsRoutes.post('/init', async (c) => { c.req.header('cf-connecting-ip') ?? c.req.header('x-forwarded-for') ?? 'unknown'; const ipHashValue = await hashIp(ip, IP_HASH_SALT); - const initialStatus = cfg.moderation === 'pre' ? 'pending' : 'approved'; - const approvedAt = initialStatus === 'approved' ? Date.now() : null; - if (input.sizeBytes <= SINGLE_PUT_MAX) { const presigned = await storage.presignPut({ key: storageKey, @@ -99,10 +96,9 @@ uploadsRoutes.post('/init', async (c) => { durationSeconds: input.durationSeconds ?? null, authorName: input.authorName?.trim() || null, message: input.message?.trim() || null, - status: initialStatus, + status: 'pending', source: 'guest', ipHash: ipHashValue, - approvedAt, }); const response: UploadInitResponse = {