Use url.hostname instead of url.host to allow host from environment variable (#326)

Co-authored-by <yohan.boniface@free.fr>
This commit is contained in:
Louis Delbosc
2022-10-25 20:59:17 +02:00
committed by GitHub
parent caef8bae22
commit eea2ef5cfb
2 changed files with 3 additions and 2 deletions

View File

@@ -117,7 +117,7 @@ export function matchesBaseDomain(domain: string, baseDomain: string) {
}
export function isEnvironmentAllowedHost(url: string|URL) {
const urlHost = (typeof url === 'string') ? url : url.host;
const urlHost = (typeof url === 'string') ? url : url.hostname;
return (process.env.GRIST_ALLOWED_HOSTS || "").split(",").some(domain =>
domain && matchesBaseDomain(urlHost, domain)
);