From cc18fa56fb271b4251aaad9965f7f9257d3f9a7a Mon Sep 17 00:00:00 2001 From: Omer Koren Date: Wed, 1 Aug 2018 16:03:57 +0300 Subject: [PATCH 1/2] fix domain extraction in undertone adapter There was a bug when trying to extract domain from hostnames with two letter suffixes such as .co / .io / etc This fix solves this issue --- modules/undertoneBidAdapter.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/modules/undertoneBidAdapter.js b/modules/undertoneBidAdapter.js index 1f32fe0347a..1fc6773d692 100644 --- a/modules/undertoneBidAdapter.js +++ b/modules/undertoneBidAdapter.js @@ -21,11 +21,15 @@ export const spec = { 'x-ut-hb-params': [] }; const location = utils.getTopWindowLocation(); - let domain = /[-\w]+\.(?:[-\w]+\.xn--[-\w]+|[-\w]{3,}|[-\w]+\.[-\w]{2})$/i.exec(location.host); - if (domain == null || domain.length == 0) { - domain = null; - } else { - domain = domain[0]; + let domains = /[-\w]+\.([-\w]+|[-\w]{3,}|[-\w]{1,3}\.[-\w]{2})$/i.exec(location.host); + let domain = null; + if (domains != null && domains.length > 0) { + domain = domains[0]; + for (let i=1; i domain.length) { + domain=domains[i]; + } + } } const pubid = validBidRequests[0].params.publisherId; From e8aa70574a69e5877023a707a95820042314518e Mon Sep 17 00:00:00 2001 From: Omer Koren Date: Wed, 1 Aug 2018 17:05:38 +0300 Subject: [PATCH 2/2] fix lint issues --- modules/undertoneBidAdapter.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/undertoneBidAdapter.js b/modules/undertoneBidAdapter.js index 1fc6773d692..d7e063b85f5 100644 --- a/modules/undertoneBidAdapter.js +++ b/modules/undertoneBidAdapter.js @@ -25,9 +25,9 @@ export const spec = { let domain = null; if (domains != null && domains.length > 0) { domain = domains[0]; - for (let i=1; i domain.length) { - domain=domains[i]; + domain = domains[i]; } } }