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

PAAPI: fix bug where auctions break if adunits have only placeholder sizes #12222

Merged
merged 1 commit into from
Sep 10, 2024
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
4 changes: 3 additions & 1 deletion modules/paapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,11 @@ function getFledgeConfig(bidder) {
* Given an array of size tuples, return the one that should be used for PAAPI.
*/
export const getPAAPISize = hook('sync', function (sizes) {
sizes = sizes
?.filter(([w, h]) => !(w === h && w <= 5));

if (sizes?.length) {
return sizes
.filter(([w, h]) => !(w === h && w <= 5))
.reduce(maximum(keyCompare(([w, h]) => w * h)));
}
}, 'getPAAPISize');
Expand Down
4 changes: 4 additions & 0 deletions test/spec/modules/paapi_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,10 @@ describe('paapi module', () => {
'can handle no input': {
in: undefined,
out: undefined
},
'can handle placeholder sizes': {
in: [[1, 1]],
out: undefined
}
}).forEach(([t, {in: input, out}]) => {
it(t, () => {
Expand Down