diff --git a/server/routes/api/attachments.ts b/server/routes/api/attachments.ts index e66e95386..4c92ea15b 100644 --- a/server/routes/api/attachments.ts +++ b/server/routes/api/attachments.ts @@ -147,7 +147,7 @@ router.post("attachments.delete", auth(), async (ctx) => { }); const handleAttachmentsRedirect = async (ctx: ContextWithState) => { - const { id } = (ctx.request.body ?? ctx.request.query) as { id?: string }; + const id = ctx.request.body?.id ?? ctx.request.query?.id; assertUuid(id, "id is required"); const { user } = ctx.state; diff --git a/server/routes/api/cron.ts b/server/routes/api/cron.ts index c8b7da4ed..065c61f0e 100644 --- a/server/routes/api/cron.ts +++ b/server/routes/api/cron.ts @@ -12,7 +12,9 @@ import InviteReminderTask from "@server/queues/tasks/InviteReminderTask"; const router = new Router(); const cronHandler = async (ctx: Context) => { - const { token, limit = 500 } = (ctx.request.body ?? ctx.request.query) as { + const { token, limit = 500 } = (ctx.method === "POST" + ? ctx.request.body + : ctx.request.query) as { token?: string; limit: number; }; diff --git a/server/routes/api/fileOperations.ts b/server/routes/api/fileOperations.ts index a956e69d4..5d0ca697c 100644 --- a/server/routes/api/fileOperations.ts +++ b/server/routes/api/fileOperations.ts @@ -70,7 +70,7 @@ router.post( ); const handleFileOperationsRedirect = async (ctx: ContextWithState) => { - const { id } = (ctx.request.body ?? ctx.request.query) as { id?: string }; + const id = ctx.request.body?.id ?? ctx.request.query?.id; assertUuid(id, "id is required"); const { user } = ctx.state; diff --git a/server/routes/api/notificationSettings.ts b/server/routes/api/notificationSettings.ts index 9f27dc077..5b0c5726f 100644 --- a/server/routes/api/notificationSettings.ts +++ b/server/routes/api/notificationSettings.ts @@ -57,7 +57,9 @@ router.post("notificationSettings.delete", auth(), async (ctx) => { }); const handleUnsubscribe = async (ctx: ContextWithState) => { - const { id, token } = (ctx.request.body ?? ctx.request.query) as { + const { id, token } = (ctx.method === "POST" + ? ctx.request.body + : ctx.request.query) as { id?: string; token?: string; };