Skip to content

Commit

Permalink
only set mediaTypes.banner.sizes from sizes if mediaTypes doesn't exi…
Browse files Browse the repository at this point in the history
…st. (prebid#3274)

fixed prebid#3269
  • Loading branch information
snapwich authored and AdSpacesDevelopers committed Jan 30, 2019
1 parent 8ce8112 commit 6cfb33f
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/sizeMapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down

0 comments on commit 6cfb33f

Please sign in to comment.