From 8ff11b6e9e9b7a083930c26fe7d3f132fe1ead0c Mon Sep 17 00:00:00 2001 From: bsardo <1168933+bsardo@users.noreply.github.com> Date: Thu, 25 Jul 2024 17:36:34 -0400 Subject: [PATCH] Fix: add site.publisher nil check --- .../triplelift_native/triplelift_native.go | 2 +- .../supplemental/no-site.json | 40 +++++++++++++++++++ .../supplemental/nopub.json | 37 ----------------- .../supplemental/site-no-publisher.json | 25 ++++++++++++ 4 files changed, 66 insertions(+), 38 deletions(-) create mode 100644 adapters/triplelift_native/triplelift_nativetest/supplemental/no-site.json delete mode 100644 adapters/triplelift_native/triplelift_nativetest/supplemental/nopub.json create mode 100644 adapters/triplelift_native/triplelift_nativetest/supplemental/site-no-publisher.json diff --git a/adapters/triplelift_native/triplelift_native.go b/adapters/triplelift_native/triplelift_native.go index 465ea32df59..ff9733d13bc 100644 --- a/adapters/triplelift_native/triplelift_native.go +++ b/adapters/triplelift_native/triplelift_native.go @@ -75,7 +75,7 @@ func processImp(imp *openrtb2.Imp, request *openrtb2.BidRequest) error { } if extData.TagCode != "" { - if siteCopy.Publisher.Domain == "msn.com" { + if siteCopy.Publisher != nil && siteCopy.Publisher.Domain == "msn.com" { imp.TagID = extData.TagCode } else { imp.TagID = tlext.InvCode diff --git a/adapters/triplelift_native/triplelift_nativetest/supplemental/no-site.json b/adapters/triplelift_native/triplelift_nativetest/supplemental/no-site.json new file mode 100644 index 00000000000..04150f8b18d --- /dev/null +++ b/adapters/triplelift_native/triplelift_nativetest/supplemental/no-site.json @@ -0,0 +1,40 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "app": { + "publisher": { + "ext": { + "prebid": { + "parentAccount": "faz" + } + }, + "id": "far", + "name": "bar" + } + }, + "imp": [{ + "id": "test-imp-id", + "banner": { + "format": [{ + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "inventoryCode": "foo", + "floor": 20 + } + } + }] + }, + "expectedMakeRequestsErrors": [{ + "value": "Unsupported publisher for triplelift_native", + "comparison": "literal" + }] +} \ No newline at end of file diff --git a/adapters/triplelift_native/triplelift_nativetest/supplemental/nopub.json b/adapters/triplelift_native/triplelift_nativetest/supplemental/nopub.json deleted file mode 100644 index cdeaff3961a..00000000000 --- a/adapters/triplelift_native/triplelift_nativetest/supplemental/nopub.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "expectedMakeRequestsErrors": [ - { - "value": "Unsupported publisher for triplelift_native", - "comparison": "literal" - } - ], - "mockBidRequest": { - "id": "test-request-id", - "app": { "publisher": {"ext":{"prebid":{"parentAccount":"faz"}}, "id":"far","name":"bar"}}, - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 - } - ] - }, - "ext": { - "bidder": { - "inventoryCode": "foo", - "floor": 20 - } - } - } - ] - }, - "httpCalls": [ - ] -} diff --git a/adapters/triplelift_native/triplelift_nativetest/supplemental/site-no-publisher.json b/adapters/triplelift_native/triplelift_nativetest/supplemental/site-no-publisher.json new file mode 100644 index 00000000000..23b55deb02e --- /dev/null +++ b/adapters/triplelift_native/triplelift_nativetest/supplemental/site-no-publisher.json @@ -0,0 +1,25 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "site": {}, + "imp": [{ + "native": { + "request": "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}" + }, + "id": "test-imp-id", + "ext": { + "bidder": { + "inventoryCode": "foo", + "floor": 20 + }, + "data": { + "tag_code": "bar" + } + } + }] + }, + "expectedMakeRequestsErrors": [{ + "value": "Unsupported publisher for triplelift_native", + "comparison": "literal" + }] +} \ No newline at end of file