Skip to content

Commit

Permalink
Remove cache busting prefix from pixel live URL when validating
Browse files Browse the repository at this point in the history
  • Loading branch information
sammacbeth committed Jan 10, 2025
1 parent d03e9d1 commit 7758486
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/params_validator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ export class ParamsValidator {

const urlSplit = url.split('/')[2].split('?');
const livePixelName = urlSplit[0].replaceAll('_', '.');
const livePixelRequestParams = urlSplit[1];
// grab pixel parameters with any preciding cache buster removed
const livePixelRequestParams = /^([0-9]+&)?(.*)$/.exec(urlSplit[1])[2]

// 1) Validate pixel name if it's parameterized
if (livePixelName.length > prefix.length) {
Expand All @@ -156,6 +157,7 @@ export class ParamsValidator {

// 2) Validate pixel params
const validateParams = this.compileParamsSchema(pixelDef.parameters);

const paramsStruct = Object.fromEntries(new URLSearchParams(livePixelRequestParams));
validateParams(paramsStruct);
errors.push(...formatAjvErrors(validateParams.errors));
Expand Down

0 comments on commit 7758486

Please sign in to comment.