From 186ee66de03b80746844aaa1c0dfec3ad3bd682e Mon Sep 17 00:00:00 2001 From: Rich Snapp Date: Thu, 15 Nov 2018 10:03:21 -0700 Subject: [PATCH] only set mediaTypes.banner.sizes from sizes if mediaTypes doesn't exist. (#3274) fixed #3269 --- src/sizeMapping.js | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/sizeMapping.js b/src/sizeMapping.js index 2cf1b1a0fa9..1a9746205b6 100644 --- a/src/sizeMapping.js +++ b/src/sizeMapping.js @@ -65,22 +65,20 @@ export function resolveStatus({labels = [], labelAll = false, activeLabels = []} let maps = evaluateSizeConfig(configs); if (!isPlainObject(mediaTypes)) { - mediaTypes = {}; + // add support for deprecated adUnit.sizes by creating correct banner mediaTypes if they don't already exist + if (sizes) { + mediaTypes = { + banner: { + sizes + } + }; + } else { + mediaTypes = {}; + } } else { mediaTypes = deepClone(mediaTypes); } - // add support for deprecated adUnit.sizes by creating correct banner mediaTypes if they don't already exist - if (sizes) { - if (!mediaTypes.banner) { - mediaTypes.banner = { - sizes - } - } else if (!mediaTypes.banner.sizes) { - mediaTypes.banner.sizes = sizes; - } - } - let oldSizes = deepAccess(mediaTypes, 'banner.sizes'); if (maps.shouldFilter && oldSizes) { mediaTypes.banner.sizes = oldSizes.filter(size => maps.sizesSupported[size]);