fix: Multi-method handlers, regressed in methodOverride removal
This commit is contained in:
@@ -147,7 +147,7 @@ router.post("attachments.delete", auth(), async (ctx) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const handleAttachmentsRedirect = async (ctx: ContextWithState) => {
|
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");
|
assertUuid(id, "id is required");
|
||||||
|
|
||||||
const { user } = ctx.state;
|
const { user } = ctx.state;
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ import InviteReminderTask from "@server/queues/tasks/InviteReminderTask";
|
|||||||
const router = new Router();
|
const router = new Router();
|
||||||
|
|
||||||
const cronHandler = async (ctx: Context) => {
|
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;
|
token?: string;
|
||||||
limit: number;
|
limit: number;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ router.post(
|
|||||||
);
|
);
|
||||||
|
|
||||||
const handleFileOperationsRedirect = async (ctx: ContextWithState) => {
|
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");
|
assertUuid(id, "id is required");
|
||||||
|
|
||||||
const { user } = ctx.state;
|
const { user } = ctx.state;
|
||||||
|
|||||||
@@ -57,7 +57,9 @@ router.post("notificationSettings.delete", auth(), async (ctx) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const handleUnsubscribe = async (ctx: ContextWithState) => {
|
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;
|
id?: string;
|
||||||
token?: string;
|
token?: string;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user