From 7b4de4125f2d7fd2a01425bc77f9bea626fbdbf3 Mon Sep 17 00:00:00 2001 From: naskya Date: Thu, 13 Jul 2023 13:22:50 +0000 Subject: [PATCH] fix #10483 --- packages/backend/src/server/api/service/discord.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend/src/server/api/service/discord.ts b/packages/backend/src/server/api/service/discord.ts index 296e9cb48..848a70d4a 100644 --- a/packages/backend/src/server/api/service/discord.ts +++ b/packages/backend/src/server/api/service/discord.ts @@ -18,7 +18,7 @@ function getUserToken(ctx: Koa.BaseContext): string | null { function compareOrigin(ctx: Koa.BaseContext): boolean { function normalizeUrl(url?: string): string { - return slice( url.length - 1) : url) : ""; + return url ? (url.endsWith("/") ? url.slice(0, url.length - 1) : url) : ""; } const referer = ctx.headers["referer"];