-
Notifications
You must be signed in to change notification settings - Fork 262
Update Url Processing #970
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new keep configuration option to preserve specific URL query parameters from being truncated during URL scrubbing. The feature reorders query strings to move "kept" parameters to the front, ensuring they remain within the maxUrlLength limit when truncation occurs.
Key changes:
- Added
keepparameter to the Config interface alongside existingdropparameter - Implemented logic to reorder query parameters, placing kept parameters first
- Initialized default
keepconfiguration as an empty array
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/clarity-js/types/core.d.ts | Added keep?: string[] to Config interface |
| packages/clarity-js/src/core/config.ts | Initialized default keep configuration as empty array |
| packages/clarity-js/src/core/scrub.ts | Implemented query parameter reordering logic to prioritize kept parameters before truncation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 2 out of 3 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4719674 to
be8a4d7
Compare
| } | ||
|
|
||
| if (truncate) { | ||
| result = result.substring(0, maxUrlLength); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should keep override truncate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you suggesting we don't truncate if keep portion exceeds maxUrlLength?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. I believe we should:
- Split the URL into its components: path, domain, query, URL hash.
- Apply the drop logic
- Form the keep part if keep list is non-empty
- Apply the truncatation t o the components:
- iif truncation on the core (path) part should we really truncate?
- Add the keep parameters to the truncated core
- Add any remaining parameters if truncation is not needed. Try to truncate at parameter unit not just a simple string truncate.
the above would be ideal
be8a4d7 to
25f9584
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.
3adb2d9 to
b5bc75d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 3 out of 4 changed files in this pull request and generated 17 comments.
Update url processing to keep certain parameters