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

PBS Adapter: handle edge case with duplicated EID permissions #12595

Merged
merged 2 commits into from
Dec 19, 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
6 changes: 3 additions & 3 deletions modules/prebidServerBidAdapter/bidderConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function extractEids({global, bidder}) {
function getEntry(eid) {
let entry = entries.find((candidate) => deepEqual(candidate.eid, eid));
if (entry == null) {
entry = {eid, bidders: []}
entry = {eid, bidders: new Set()}
entries.push(entry);
}
if (bySource[eid.source] == null) {
Expand All @@ -74,12 +74,12 @@ export function extractEids({global, bidder}) {
(deepAccess(bidderConfig, path) || []).forEach(eid => {
const entry = getEntry(eid);
if (entry.bidders !== false) {
entry.bidders.push(bidderCode);
entry.bidders.add(bidderCode);
}
})
})
})
return {eids: entries, conflicts};
return {eids: entries.map(({eid, bidders}) => ({eid, bidders: bidders && Array.from(bidders)})), conflicts};
}

/**
Expand Down
17 changes: 16 additions & 1 deletion test/spec/modules/prebidServerBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2130,7 +2130,7 @@ describe('S2S Adapter', function () {
bidders: [],
source: 'idD'
}]);
})
});

it('should repeat global EIDs when bidder-specific EIDs conflict', () => {
BID_REQUESTS.push({
Expand Down Expand Up @@ -4638,6 +4638,21 @@ describe('S2S Adapter', function () {
],
conflicts: ['idA', 'idB']
}
},
{
t: 'duplicated bidder-specific eids',
bidder: {
bidderA: {
user: {
eids: [mkEid('id'), mkEid('id')]
}
}
},
expected: {
eids: [
eidEntry('id', 'id', ['bidderA'])
]
}
}
].forEach(({t, global = {}, bidder = {}, expected}) => {
it(t, () => {
Expand Down
Loading