Skip to content

Commit

Permalink
Prebid core: fix image assets in converted legacy response (#9752)
Browse files Browse the repository at this point in the history
  • Loading branch information
JulieLorin authored Apr 11, 2023
1 parent 5269653 commit dd611c3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/native.js
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,11 @@ export function toLegacyResponse(ortbResponse, ortbRequest) {
if (asset.title) {
legacyResponse.title = asset.title.text;
} else if (asset.img) {
legacyResponse[requestAsset.img.type === NATIVE_IMAGE_TYPES.MAIN ? 'image' : 'icon'] = asset.img.url;
legacyResponse[requestAsset.img.type === NATIVE_IMAGE_TYPES.MAIN ? 'image' : 'icon'] = {
url: asset.img.url,
width: asset.img.w,
height: asset.img.h
};
} else if (asset.data) {
legacyResponse[PREBID_NATIVE_DATA_KEYS_TO_ORTB_INVERSE[NATIVE_ASSET_TYPES_INVERSE[requestAsset.data.type]]] = asset.data.value;
}
Expand Down
4 changes: 2 additions & 2 deletions test/spec/auctionmanager_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1403,8 +1403,8 @@ describe('auctionmanager.js', function () {
assert.equal(addedBid.native.title, 'Sample title')
assert.equal(addedBid.native.sponsoredBy, 'Sample sponsoredBy')
assert.equal(addedBid.native.clickUrl, 'http://www.click.com')
assert.equal(addedBid.native.image, 'https://www.example.com/image.png')
assert.equal(addedBid.native.icon, 'https://www.example.com/icon.png')
assert.equal(addedBid.native.image.url, 'https://www.example.com/image.png')
assert.equal(addedBid.native.icon.url, 'https://www.example.com/icon.png')
assert.equal(addedBid.native.impressionTrackers[0], 'http://www.imptracker.com')
assert.equal(addedBid.native.javascriptTrackers, '<script async src="http://www.jstracker.com/file.js"></script>')
});
Expand Down

0 comments on commit dd611c3

Please sign in to comment.