Skip to content

Commit 9a062d9

Browse files
authored
sevioBidAdapter_bugfix: Send all sizes instead of just maxSize (prebid#14133)
* Send all sizes instead of just maxSize * Added tests to cover modifs in the sizes that we are sending
1 parent 2ccc9ee commit 9a062d9

File tree

2 files changed

+44
-7
lines changed

2 files changed

+44
-7
lines changed

modules/sevioBidAdapter.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,12 @@ export const spec = {
179179

180180
return bidRequests.map((bidRequest) => {
181181
const isNative = detectAdType(bidRequest)?.toLowerCase() === 'native';
182-
const size = bidRequest.mediaTypes?.banner?.sizes[0] || bidRequest.mediaTypes?.native?.sizes[0] || [];
183-
const width = size[0];
184-
const height = size[1];
182+
const adSizes = bidRequest.mediaTypes?.banner?.sizes || bidRequest.mediaTypes?.native?.sizes || [];
183+
const formattedSizes = Array.isArray(adSizes)
184+
? adSizes
185+
.filter(size => Array.isArray(size) && size.length === 2)
186+
.map(([width, height]) => ({ width, height }))
187+
: [];
185188
const originalAssets = bidRequest.mediaTypes?.native?.ortb?.assets || [];
186189

187190
// convert icon to img type 1
@@ -211,10 +214,7 @@ export const spec = {
211214
})).filter(eid => eid.source && eid.id),
212215
ads: [
213216
{
214-
maxSize: {
215-
width: width,
216-
height: height,
217-
},
217+
sizes: formattedSizes,
218218
referenceId: bidRequest.params.referenceId,
219219
tagId: bidRequest.params.zone,
220220
type: detectAdType(bidRequest),

test/spec/modules/sevioBidAdapter_spec.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,5 +408,42 @@ describe('sevioBidAdapter', function () {
408408
Object.defineProperty(perfTop, 'timing', { configurable: true, value: undefined });
409409
}
410410
});
411+
412+
it('handles multiple sizes correctly', function () {
413+
const multiSizeBidRequests = [
414+
{
415+
bidder: 'sevio',
416+
params: { zone: 'zoneId' },
417+
mediaTypes: {
418+
banner: {
419+
sizes: [
420+
[300, 250],
421+
[728, 90],
422+
[160, 600],
423+
]
424+
}
425+
},
426+
bidId: 'multi123',
427+
}
428+
];
429+
430+
const bidderRequests = {
431+
refererInfo: {
432+
numIframes: 0,
433+
reachedTop: true,
434+
referer: 'https://example.com',
435+
stack: ['https://example.com']
436+
}
437+
};
438+
439+
const request = spec.buildRequests(multiSizeBidRequests, bidderRequests);
440+
const sizes = request[0].data.ads[0].sizes;
441+
442+
expect(sizes).to.deep.equal([
443+
{ width: 300, height: 250 },
444+
{ width: 728, height: 90 },
445+
{ width: 160, height: 600 },
446+
]);
447+
});
411448
});
412449
});

0 commit comments

Comments
 (0)