From 3ea1f72bc31ebd417c70f02b11a28e66abb4fb5a Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sat, 6 Jan 2024 08:15:31 -0800 Subject: [PATCH] fix: www. should not be counted as an internal URL (#6351) --- shared/utils/urls.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/shared/utils/urls.ts b/shared/utils/urls.ts index 73adb45b0..350ae2fb7 100644 --- a/shared/utils/urls.ts +++ b/shared/utils/urls.ts @@ -1,6 +1,6 @@ import escapeRegExp from "lodash/escapeRegExp"; import env from "../env"; -import { getBaseDomain, parseDomain } from "./domains"; +import { RESERVED_SUBDOMAINS, getBaseDomain, parseDomain } from "./domains"; /** * Prepends the CDN url to the given path (If a CDN is configured). @@ -35,7 +35,11 @@ export function isInternalUrl(href: string) { : parseDomain(env.URL); const domain = parseDomain(href); - return outline.host === domain.host || domain.host.endsWith(getBaseDomain()); + return ( + outline.host === domain.host || + (domain.host.endsWith(getBaseDomain()) && + !RESERVED_SUBDOMAINS.includes(domain.teamSubdomain)) + ); } /**