From 42ce75c63c000aaad6cbaac19ca08c02e9302c01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20Unneb=C3=A4ck?= Date: Sun, 16 Jan 2022 14:21:53 +0100 Subject: [PATCH] Simplify check in isDomainOrSubdomain --- src/utils/is.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/utils/is.js b/src/utils/is.js index 876ab4733..00eb89b0e 100644 --- a/src/utils/is.js +++ b/src/utils/is.js @@ -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}`); };