Skip to content

Commit

Permalink
PAAPI: fix bug where auctions break if adunits have only placeholder …
Browse files Browse the repository at this point in the history
…sizes (#12222)
  • Loading branch information
dgirardi authored Sep 10, 2024
1 parent 0a7627e commit 657228d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
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

0 comments on commit 657228d

Please sign in to comment.