Skip to content

Commit

Permalink
Improve special character escaping in CMCD string values (#3866)
Browse files Browse the repository at this point in the history
  • Loading branch information
littlespex authored Jan 31, 2022
1 parent 13a8c23 commit a83535d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/streaming/models/CmcdModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -512,8 +512,7 @@ function CmcdModel() {
let cmcdString = keys.reduce((acc, key, index) => {
if (key === 'v' && cmcdData[key] === 1) return acc; // Version key should only be reported if it is != 1
if (typeof cmcdData[key] === 'string' && key !== 'ot' && key !== 'sf' && key !== 'st') {
let string = cmcdData[key].replace(/"/g, '\"');
acc += `${key}="${string}"`;
acc += `${key}=${JSON.stringify(cmcdData[key])}`;
} else {
acc += `${key}=${cmcdData[key]}`;
}
Expand Down
4 changes: 2 additions & 2 deletions test/unit/streaming.models.CmcdModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ describe('CmcdModel', function () {
expect(metrics.sf).to.equal('s');
});

it('getHeaderParameters() returns CID in metrics if expicitly set', function () {
it('getHeaderParameters() returns CID in metrics if explicitly set', function () {
const REQUEST_TYPE = HTTPRequest.MPD_TYPE;
const MEDIA_TYPE = 'video';
const CID = 'content_id';
Expand Down Expand Up @@ -623,7 +623,7 @@ describe('CmcdModel', function () {
expect(metrics.sf).to.equal('s');
});

it('getQueryParameter() returns CID in metrics if expicitly set', function () {
it('getQueryParameter() returns CID in metrics if explicitly set', function () {
const REQUEST_TYPE = HTTPRequest.MPD_TYPE;
const MEDIA_TYPE = 'video';
const CID = 'content_id';
Expand Down

0 comments on commit a83535d

Please sign in to comment.