Skip to content

CDP-5966: make getCustomersByEmail query-safe (drop cleanEmail, use encodeURIComponent)#193

Merged
sydneycollins-cio merged 6 commits into
mainfrom
sydney/cdp-5966-email-encode
May 21, 2026
Merged

CDP-5966: make getCustomersByEmail query-safe (drop cleanEmail, use encodeURIComponent)#193
sydneycollins-cio merged 6 commits into
mainfrom
sydney/cdp-5966-email-encode

Conversation

@sydneycollins-cio
Copy link
Copy Markdown
Contributor

@sydneycollins-cio sydneycollins-cio commented May 21, 2026

What

Fixes getCustomersByEmail to correctly encode the full email value in the query string. The previous cleanEmail helper only encoded each side of @ separately, leaving reserved characters like &, #, and ? unencoded — corrupting the query string.

Changes

lib/utils.ts — remove cleanEmail helper (no other callers).

lib/api.ts — replace cleanEmail(email) with encodeURIComponent(email) in getCustomersByEmail. Remove cleanEmail import.

test/util.ts — remove cleanEmail tests (helper no longer exists).

test/api.ts — update existing default test to expect encodeURIComponent output. Add two new tests covering emails with reserved characters (&, +, #, ?).

Closes CDP-5966.


Note

Low Risk
Low risk: small change to URL encoding for a single API call plus accompanying test updates; behavior only differs for emails containing reserved URL characters.

Overview
Fixes APIClient.getCustomersByEmail to build a query-safe request by encoding the entire email with encodeURIComponent instead of the removed cleanEmail helper.

Removes cleanEmail from lib/utils.ts, deletes its unit test, and updates/adds test/api.ts coverage to assert correct encoding for reserved characters like &, #, and ?.

Reviewed by Cursor Bugbot for commit 3e4fc10. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7ad38bb. Configure here.

Comment thread test/util.ts
@sydneycollins-cio sydneycollins-cio merged commit 30ad14a into main May 21, 2026
9 checks passed
@sydneycollins-cio sydneycollins-cio deleted the sydney/cdp-5966-email-encode branch May 21, 2026 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants