Simplify check in isDomainOrSubdomain (#1455)

This commit is contained in:
Linus Unnebäck 2022-01-16 16:08:23 +01:00 committed by GitHub
parent 36e47e8a64
commit 92dee097c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 3 deletions

View File

@ -69,7 +69,5 @@ export const isDomainOrSubdomain = (destination, original) => {
const orig = new URL(original).hostname;
const dest = new URL(destination).hostname;
return orig === dest || (
orig[orig.length - dest.length - 1] === '.' && orig.endsWith(dest)
);
return orig === dest || orig.endsWith(`.${dest}`);
};