{{ message }}
Repository navigation
Conversation
parseQuery called decodeURIComponent on every query value. A bare % in the page URL (e.g. ?discount=50%) throws URIError there, adjustPayload fails, and the event is never sent. Malformed values are now kept as they are.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What breaks
If the page URL has a bare
%in its query string,@jitsu/jsdrops the event. For examplehttps://shop.example.com/sale?discount=50%&utm_source=newsletter. Browsers keep a bare%as-is inlocation.href, andnew URL()does too.adjustPayload→parseQuerycallsdecodeURIComponenton every key and value.decodeURIComponent("50%")throwsURIError: URI malformed, sosend()rejects before the fetch. The plugin swallows the rejection withpromise.catch(() => {}), so nothing is sent and nothing is logged. In the Node test below, thetrack()promise also never settles. Everypage/track/identifycall on that URL is lost, including the UTM campaign data.Fix
parseQuerynow uses a smallsafeDecodeURIComponent: it triesdecodeURIComponentand falls back to the raw string. Well-formed values decode exactly as before.Tests
New cases in
libs/jitsu-js/__tests__/node/nodejs.test.ts:a stray % in the page URL does not drop the event: uses a runtime whosepageUrl()has?discount=50%&utm_source=newsletter. It checks that the local test server receives the event withcontext.campaign = { source: "newsletter" }.parseQuery keeps malformed percent-encoding as isWithout the fix:
expected +0 to be 1(no request reached the server) andURIError: URI malformed. With the fix, the full@jitsu/jsvitest suite passes (17/17).tsc --noEmitand prettier are clean.This was found and fixed by an AI agent (Breken) and checked with the repo's own test suite.