From db2946c68ec2d8722a9aed80d0d4a2758110eebc Mon Sep 17 00:00:00 2001 From: Regalijan Date: Tue, 26 Mar 2024 04:14:44 -0400 Subject: [PATCH] The coconut token value is a string, not an object --- functions/api/coconut.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/functions/api/coconut.ts b/functions/api/coconut.ts index dfc7d81..086d6b5 100644 --- a/functions/api/coconut.ts +++ b/functions/api/coconut.ts @@ -10,15 +10,14 @@ export async function onRequestPost(context: RequestContext) { return jsonError("Invalid report id or token", 400); const id = attachment.replace(/\.mp4$/, ""); - const coconutData: { token: string } | null = await context.env.DATA.get( + const coconutToken: string | null = await context.env.DATA.get( `coconutjob_${id}`, - { type: "json" }, ); - if (!coconutData) + if (!coconutToken) return jsonError("Request is stale or otherwise invalid", 400); - if (coconutData.token !== token) return jsonError("Forbidden", 403); + if (coconutToken !== token) return jsonError("Forbidden", 403); await context.env.DATA.delete(`coconutjob_${id}`);