You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With URL Encoding enabled, /Jos%C3%A9% becomes /Jos%25C3%25A9%25, changing the requested resource. decodeURIComponent rejects the trailing bare percent, and the fallback cannot decode é one UTF-8 byte at a time. Chinese and emoji paths fail the same way.
Fix
In the fallback only, match complete two-, three- and four-byte UTF-8 character candidates before trying individual encoded bytes. decodeURIComponent still validates each candidate; malformed UTF-8 stays verbatim for the existing path encoder to escape safely. The normal decoding path and query-parameter double-encoding contract are unchanged.
Both the CLI and Electron network handlers already call this shared encodeUrl, so no runtime-specific copy needs updating. Add four regression cases for accented, Chinese and emoji paths and an invalid byte preceding valid UTF-8. Each also checks the existing query encoding behavior.
Validation
Node 24.22.1 on macOS arm64, dependencies from the frozen npm lockfile (scoped common/lang workspaces plus root tooling).
Before the fix: URL suite 4 failed, 90 passed.
After: all bruno-common suites 24 passed, 742 tests passed, 4 snapshots passed (npm test --workspace=packages/bruno-common -- --runInBand).
npm run build:bruno-common: passed, including CJS/ESM bundles and declarations.
ESLint on both changed files and git diff --check: passed.
Real loopback HTTP probe using the built common package: received /José%, /中%ZZ and /😀% as intended.
Ran the repository's code-review skill across all six applicable lenses: correctness, security, architecture, conventions, cross-platform and feature parity; no findings.
The scoped install nests TypeScript under bruno-common, so build/lint used that directory in NODE_PATH to resolve existing tooling peer dependencies. No dependency manifests or lockfiles changed. No full Electron UI or packaged CLI journey was run; verification covers the shared encoder and actual loopback requests through its built output.
Screenshots
Not applicable to the shared encoding utility. Example: https://example.com/Jos%C3%A9% now produces https://example.com/Jos%C3%A9%25 instead of https://example.com/Jos%25C3%25A9%25.
Contribution Checklist:
I've used AI significantly to create this pull request
The pull request only addresses one issue or adds one feature.
The pull request does not introduce any breaking changes
I have tested these changes locally and confirmed they work as expected.
I have added screenshots or gifs to help explain the change if applicable.
No actionable comments were generated in the recent review.
Walkthrough
The URL decoder fallback now matches complete UTF-8 percent-encoded sequences before individual escapes. Regression tests cover malformed and invalid escapes beside valid encoded Unicode in paths.
Changes
URL encoding fallback
Layer / File(s)
Summary
UTF-8 fallback and regression coverage packages/bruno-common/src/utils/url/index.ts, packages/bruno-common/src/utils/url/index.spec.ts
safeDecodeURIComponent matches complete UTF-8 escape sequences in its fallback. Tests verify path encoding with malformed or invalid escapes beside valid encoded Unicode, and preserve the existing query encoding behavior.
usebruno/bruno#9630: Adds URL-encoding coverage for encoded and Unicode paths in HTTP/2 request flows that use the shared encodeUrl function.
Suggested reviewers: bijin-bruno, shubh-bruno
Merge Risk: Minimal · up to 1b42a
No merge-blocking issue was identified in the changed URL encoding behavior.
Pre-merge checks: 5
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title names the change: Unicode beside malformed URL escapes is preserved, scoped to the shared common package. It matches the raw summary of the safeDecodeURIComponent fallback and the added enco…
Linked Issues check
Issue #9752 requires a focused shared URL-encoder fix and regression tests. safeDecodeURIComponent now matches complete two-, three-, and four-byte UTF-8 escape sequences before byte-level fallback.…
Out of Scope Changes check
The diff changes only packages/bruno-common/src/utils/url/index.ts and its focused test file. The production change supports issue #9752, and the added tests verify the requested path behavior and u…
Docstring Coverage
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Title check
Explanation
The title names the change: Unicode beside malformed URL escapes is preserved, scoped to the shared common package. It matches the raw summary of the safeDecodeURIComponent fallback and the added encodeUrl regression tests, and it matches the linked issue #9752 objective.
Full details: Linked Issues check
Explanation
Issue #9752 requires a focused shared URL-encoder fix and regression tests. safeDecodeURIComponent now matches complete two-, three-, and four-byte UTF-8 escape sequences before byte-level fallback. The tests cover accented, Chinese, emoji, and invalid-byte-before-valid-UTF-8 paths. Each test also verifies that ?redirect=%20 remains ?redirect=%2520. The reported common-package test and build results support the implementation.
Full details: Out of Scope Changes check
Explanation
The diff changes only packages/bruno-common/src/utils/url/index.ts and its focused test file. The production change supports issue #9752, and the added tests verify the requested path behavior and unchanged query encoding. No dependency, runtime-specific, or unrelated feature changes appear in the reviewed diff.
Full details: Docstring Coverage
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Tip
🎯 Customize your risk assessments
Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.
✅ Automatic approvals, with your rules
Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
UTF-8 escapes stay together A stray percent takes its place Paths keep their encoded letters Tests check each tricky case Query spaces keep their rule The fallback handles the rest
Reviewing files that changed from the base of the PR and between ec84bc0 and 1b42aae.
Files selected for processing: 2
packages/bruno-common/src/utils/url/index.spec.ts
packages/bruno-common/src/utils/url/index.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
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
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.
Description
Preserve percent-encoded Unicode in URL paths when another escape in the same segment is malformed.
Problem
Fixes #9752.
With URL Encoding enabled,
/Jos%C3%A9%becomes/Jos%25C3%25A9%25, changing the requested resource.decodeURIComponentrejects the trailing bare percent, and the fallback cannot decodeéone UTF-8 byte at a time. Chinese and emoji paths fail the same way.Fix
In the fallback only, match complete two-, three- and four-byte UTF-8 character candidates before trying individual encoded bytes.
decodeURIComponentstill validates each candidate; malformed UTF-8 stays verbatim for the existing path encoder to escape safely. The normal decoding path and query-parameter double-encoding contract are unchanged.Both the CLI and Electron network handlers already call this shared
encodeUrl, so no runtime-specific copy needs updating. Add four regression cases for accented, Chinese and emoji paths and an invalid byte preceding valid UTF-8. Each also checks the existing query encoding behavior.Validation
Node 24.22.1 on macOS arm64, dependencies from the frozen npm lockfile (scoped common/lang workspaces plus root tooling).
npm test --workspace=packages/bruno-common -- --runInBand).npm run build:bruno-common: passed, including CJS/ESM bundles and declarations.git diff --check: passed./José%,/中%ZZand/😀%as intended.The scoped install nests TypeScript under bruno-common, so build/lint used that directory in
NODE_PATHto resolve existing tooling peer dependencies. No dependency manifests or lockfiles changed. No full Electron UI or packaged CLI journey was run; verification covers the shared encoder and actual loopback requests through its built output.Screenshots
Not applicable to the shared encoding utility. Example:
https://example.com/Jos%C3%A9%now produceshttps://example.com/Jos%C3%A9%25instead ofhttps://example.com/Jos%25C3%25A9%25.Contribution Checklist:
Codex assisted with discovery, implementation, verification, independent review and drafting.
Summary by CodeRabbit