fix: www. should not be counted as an internal URL (#6351)

This commit is contained in:
Tom Moor
2024-01-06 08:15:31 -08:00
committed by GitHub
parent 140526af06
commit 3ea1f72bc3

View File

@@ -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))
);
}
/**