From 49d335016f7383fd3b7879d29900961c8f21a700 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B4=87=E5=B3=B0=20=E6=9C=94=E8=8F=AF?= Date: Sat, 30 Nov 2024 15:33:35 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20=E5=88=A4=E5=AE=9A=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E3=82=92=E5=BE=8C=E6=96=B9=E4=B8=80=E8=87=B4=E3=81=8B=E3=82=89?= =?UTF-8?q?=E5=AE=8C=E5=85=A8=E4=B8=80=E8=87=B4=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/backend/src/core/UtilityService.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/core/UtilityService.ts b/packages/backend/src/core/UtilityService.ts index c6a5ae81e6..4ba6e4c7cb 100644 --- a/packages/backend/src/core/UtilityService.ts +++ b/packages/backend/src/core/UtilityService.ts @@ -50,13 +50,19 @@ export class UtilityService { @bindThis public isBlockedHost(blockedHosts: string[], host: string | null): boolean { if (host == null) return false; - return blockedHosts.some(x => `.${host.toLowerCase()}`.endsWith(`.${x}`)); + return blockedHosts.some(x => { + if (x.startsWith('.')) return `.${host.toLowerCase()}`.endsWith(x); + return host.toLowerCase() === x; + }); } @bindThis public isAllowedHost(allowedHosts: string[], host: string | null): boolean { if (host == null) return false; - return allowedHosts.some(x => `.${host.toLowerCase()}`.endsWith(`.${x}`)); + return allowedHosts.some(x => { + if (x.startsWith('.')) return `.${host.toLowerCase()}`.endsWith(x); + return host.toLowerCase() === x; + }); } @bindThis