Skip to content

fix: Correct URI encoding for tree view paths#4003

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/uri-encoding-tree-paths
Open

fix: Correct URI encoding for tree view paths#4003
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/uri-encoding-tree-paths

Conversation

@sentry

@sentry sentry Bot commented Jun 17, 2026

Copy link
Copy Markdown

Description

This PR addresses a URIError that occurred when navigating to tree views with pathnames containing literal % characters, such as Copier template syntax ([% if py3 %]).

The root cause was that path segments were not correctly encoded before being passed to React Router's Link component, leading to decodeURI failing on invalid percent-encoded sequences.

The solution involves modifying the path functions for commitTreeView, pullTreeView, and treeView in src/services/navigation/useNavLinks.ts. Each path segment is now individually encoded using encodeURIComponent to ensure special characters are properly handled, while preserving / as path separators. This prevents the URIError and allows correct navigation to these paths.

Code Example

No code example provided in the description.

Notable Changes

  • Modified path functions for commitTreeView, pullTreeView, and treeView in src/services/navigation/useNavLinks.ts.
  • Implemented individual encodeURIComponent for each path segment to correctly handle special characters like %.
  • Resolved URIError when navigating to tree views with percent characters in pathnames.

Screenshots

No screenshots provided in the description.

Link to Sample Entry

No link to a sample entry provided in the description.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

Fixes GAZEBO-1806

@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

❌ 2 Tests Failed:

Tests completed Failed Passed Skipped
1819 2 1817 2
View the top 2 failed test(s) by shortest run time
src/services/navigation/useNavLinks.test.tsx > useNavLinks > treeView link > appends other args as query params
Stack Traces | 0.00377s run time
AssertionError: expected '.../tree/main/src/?flags%…' to be '.../tree/main/src%2F?flag…' // Object.is equality

Expected: ".../tree/main/src%2F?flags%5B0%5D=flag-1"
Received: ".../tree/main/src/?flags%5B0%5D=flag-1"

 ❯ .../services/navigation/useNavLinks.test.tsx:823:24
src/services/navigation/useNavLinks.test.tsx > useNavLinks > treeView link > accepts a tree option
Stack Traces | 0.0164s run time
AssertionError: expected '.../src/view/cat…' to be '.../tree/ref/src%2Fview%2…' // Object.is equality

Expected: ".../tree/ref/src%2Fview%2FcatWatch.php"
Received: ".../src/view/catWatch.php"

 ❯ .../services/navigation/useNavLinks.test.tsx:796:24

@codecov-public-qa

Copy link
Copy Markdown

❌ 2 Tests Failed:

Tests completed Failed Passed Skipped
1222 2 1220 0
View the top 2 failed test(s) by shortest run time
src/services/navigation/useNavLinks.test.tsx > useNavLinks > treeView link > appends other args as query params
Stack Traces | 0.00377s run time
AssertionError: expected '.../tree/main/src/?flags%…' to be '.../tree/main/src%2F?flag…' // Object.is equality

Expected: ".../tree/main/src%2F?flags%5B0%5D=flag-1"
Received: ".../tree/main/src/?flags%5B0%5D=flag-1"

 ❯ .../services/navigation/useNavLinks.test.tsx:823:24
src/services/navigation/useNavLinks.test.tsx > useNavLinks > treeView link > accepts a tree option
Stack Traces | 0.0164s run time
AssertionError: expected '.../src/view/cat…' to be '.../tree/ref/src%2Fview%2…' // Object.is equality

Expected: ".../tree/ref/src%2Fview%2FcatWatch.php"
Received: ".../src/view/catWatch.php"

 ❯ .../services/navigation/useNavLinks.test.tsx:796:24

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 268 bytes (0.0%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
gazebo-production-system 5.88MB 115 bytes (0.0%) ⬆️
gazebo-production-esm 5.96MB 153 bytes (0.0%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: gazebo-production-system

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/index-legacy.*.js 115 bytes 718.6kB 0.02%

Files in assets/index-legacy.*.js:

  • ./src/services/navigation/useNavLinks.ts → Total Size: 21.57kB
view changes for bundle: gazebo-production-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/index.*.js 153 bytes 641.15kB 0.02%

Files in assets/index.*.js:

  • ./src/services/navigation/useNavLinks.ts → Total Size: 21.55kB

@codecov-releaser

Copy link
Copy Markdown
Collaborator

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Storybook

Commit Created Cloud Enterprise
3431a45 Wed, 17 Jun 2026 00:41:47 GMT Cloud Enterprise

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.

1 participant