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

Prebid Core: Remove size check on native icons and image assets #6678

Merged
merged 4 commits into from
May 12, 2021
Merged
Show file tree
Hide file tree
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
12 changes: 0 additions & 12 deletions src/native.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,6 @@ export function nativeBidIsValid(bid, bidRequests) {
return false;
}

if (deepAccess(bid, 'native.image')) {
if (!deepAccess(bid, 'native.image.height') || !deepAccess(bid, 'native.image.width')) {
return false;
}
}

if (deepAccess(bid, 'native.icon')) {
if (!deepAccess(bid, 'native.icon.height') || !deepAccess(bid, 'native.icon.width')) {
return false;
}
}

const requestedAssets = bidRequest.nativeParams;
if (!requestedAssets) {
return true;
Expand Down
18 changes: 5 additions & 13 deletions test/spec/native_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,11 +433,7 @@ describe('validate native', function () {
native: {
body: 'This is a Prebid Native Creative. There are many like it, but this one is mine.',
clickTrackers: ['http://my.click.tracker/url'],
icon: {
url: 'http://my.image.file/ad_image.jpg',
height: 0,
width: 0
},
icon: 'http://my.image.file/ad_image.jpg',
image: {
url: 'http://my.icon.file/ad_icon.jpg',
height: 2250,
Expand All @@ -463,11 +459,7 @@ describe('validate native', function () {
height: 75,
width: 75
},
image: {
url: 'http://my.icon.file/ad_icon.jpg',
height: 0,
width: 0
},
image: 'http://my.icon.file/ad_icon.jpg',
clickUrl: 'http://prebid.org/dev-docs/show-native-ads.html',
impressionTrackers: ['http://my.imp.tracker/url'],
javascriptTrackers: '<script src=\"http://www.foobar.js\"></script>',
Expand All @@ -479,12 +471,12 @@ describe('validate native', function () {

afterEach(function () {});

it('should reject bid if no image sizes are defined', function () {
it('should accept bid if no image sizes are defined', function () {
let result = nativeBidIsValid(validBid, bidReq);
expect(result).to.be.true;
result = nativeBidIsValid(noIconDimBid, bidReq);
expect(result).to.be.false;
expect(result).to.be.true;
result = nativeBidIsValid(noImgDimBid, bidReq);
expect(result).to.be.false;
expect(result).to.be.true;
});
});