Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only set mediaTypes.banner.sizes from sizes if mediaTypes doesn't exist. #3274

Merged
merged 1 commit into from
Nov 15, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this check if mediaTypes already exists, as stated in description?

I'm testing this fix out, but I still see mediaTypes.banner.sizes set when I'm only configuring an instream video mediaType.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My mistake, I was testing a prebid version without this fix. With the fix, I can confirm that it is working as expected and no longer setting mediaType.banner if only a video unit.

Thanks for the fix!

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