Skip to content

Commit

Permalink
EMXDigital: hotfix to resolve URIError from decodeURIComponent (prebi…
Browse files Browse the repository at this point in the history
…d#4333)

* hotfix to resolve URIError from decodeURIComponent

* added unit for decoding adm
  • Loading branch information
EMXDigital authored and sa1omon committed Nov 28, 2019
1 parent 33b6890 commit 5ac7f00
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/emx_digitalBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import includes from 'core-js/library/fn/array/includes';
const BIDDER_CODE = 'emx_digital';
const ENDPOINT = 'hb.emxdgt.com';
const RENDERER_URL = '//js.brealtime.com/outstream/1.30.0/bundle.js';
const ADAPTER_VERSION = '1.41.0';
const ADAPTER_VERSION = '1.41.1';
const DEFAULT_CUR = 'USD';

export const emxAdapter = {
Expand Down Expand Up @@ -116,7 +116,7 @@ export const emxAdapter = {
},
parseResponse: (bidResponseAdm) => {
try {
return decodeURIComponent(bidResponseAdm);
return decodeURIComponent(bidResponseAdm.replace(/%(?![0-9][0-9a-fA-F]+)/g, '%25'));
} catch (err) {
utils.logError('emx_digitalBidAdapter', 'error', err);
}
Expand Down
9 changes: 9 additions & 0 deletions test/spec/modules/emx_digitalBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,15 @@ describe('emx_digital Adapter', function () {
});
expect(result.length).to.equal(0);
});

it('should not throw an error when decoding an improperly encoded adm', function () {
serverResponse.seatbid[0].bid[0].adm = '<script\\ src\\=\\\"https\\:\\/\\/nym1\\-ib\\.adnxs\\.com\\/ab\\?an_audit\\=0\\&referrer=https%3A%2F%2Fwww.emxdigital.com%3Ftest%3DhAiE3%VVl%26prebid%3D%25123%25\\&e\\=wqT_3QLPCfBDzwQAAAMA1gAFAQj2iaPtBRCdw\\-qeto72gkEYlNWN2smGoJhTKjYJzGJi83G9KkARzGJi83G9KkAZAAAAgD0KEkAhzGIJGwApESTIMQAAAGBmZu4_M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D4AwOABACSBAkvb3BlbnJ0YjKYBACiBA8xNDQuMTIxLjIzMy4yMzeoBIkWsgQMCAAQABgAIAAwADgAuAQAwAQAyASxgoIB0gQOMTM1NiNOWU0yOjQyODLaBAIIAeAEAPAE6PmBFPoEEgkAAAAAZqdHQBEAAAAgWpRewIgFAZgFAKAF____________AaoFFjQ5MTgxNTcxMzQxNTU2NTI2OTQ5ZTHABQDJBQAAAAAAAPA_0gUJCQAAAAAAAAAA2AUB4AUB8AXW7gr6BQQIABAAkAYAmAYAuAYAwQYAAAAAAADwP8gGANAGwgTaBhYKEAAAAAAAAAAAAAAABQpQEAAYAOAGAfIGAggAgAcBiAcAoAcB\\&s\\=630dbbd55f593c7bfd9e7bccc4dbaa28203daaed\\&pp\\=\\$\\{EMX_MACRO\\}\\\"\\>\\<\\/script\\>';
serverResponse.seatbid[1].bid[0].adm = '%3F%%3Demx%3C3prebid'

assert.doesNotThrow(() => spec.interpretResponse({
body: serverResponse
}));
});
});

describe('getUserSyncs', function () {
Expand Down

0 comments on commit 5ac7f00

Please sign in to comment.