Skip to content

fix: improve regex in AxiosURLSearchParams#10736

Merged
jasonsaayman merged 1 commit intov1.xfrom
fix/update-bad-regex-in-url-param-search
Apr 16, 2026
Merged

fix: improve regex in AxiosURLSearchParams#10736
jasonsaayman merged 1 commit intov1.xfrom
fix/update-bad-regex-in-url-param-search

Conversation

@jasonsaayman
Copy link
Copy Markdown
Member

@jasonsaayman jasonsaayman commented Apr 16, 2026

Summary by cubic

Fix URL param encoding by removing the %00 replacement in AxiosURLSearchParams to avoid inserting null bytes. The regex now skips %00, leaving it percent-encoded.

Description

  • Summary of changes

    • Removed %00 from the char map and from the regex in encode.
    • Keeps %20+ and replacements for ! ' ( ) ~.
  • Reasoning

    • encodeURIComponent returns %00 for a null byte.
    • Replacing it with \x00 injected a raw null, which is invalid and can break consumers.
  • Additional context

    • Matches standard URL encoding expectations by keeping %00 as-is.

Docs

No docs changes needed. Behavior now matches expected form-encoding.

Testing

No tests were updated in this PR.

  • Recommended: add tests to assert:
    • Encoding "\x00" yields %00 (not a raw null).
    • Spaces still encode to +.
    • Existing replacements for ! ' ( ) ~ remain correct.

Written for commit 1c03ffe. Summary will update on new commits.

@jasonsaayman jasonsaayman self-assigned this Apr 16, 2026
@jasonsaayman jasonsaayman added priority::medium A medium priority commit::fix The PR is related to a bugfix labels Apr 16, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

@jasonsaayman jasonsaayman merged commit 5266af9 into v1.x Apr 16, 2026
25 checks passed
@jasonsaayman jasonsaayman deleted the fix/update-bad-regex-in-url-param-search branch April 16, 2026 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commit::fix The PR is related to a bugfix priority::medium A medium priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant