Skip to content
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

404 error when navigating to branch detail pages with slashes in branch names #1121

Closed
MH4GF opened this issue Apr 3, 2025 · 1 comment · Fixed by #1123
Closed

404 error when navigating to branch detail pages with slashes in branch names #1121

MH4GF opened this issue Apr 3, 2025 · 1 comment · Fixed by #1123
Labels
bug Something isn't working frontend

Comments

@MH4GF
Copy link
Member

MH4GF commented Apr 3, 2025

Problem

When navigating from ProjectBranchesListPage to a branch detail page, a 404 error occurs if the branch name contains slashes.

Current Behavior

In ProjectBranchesListPage.tsx, branch links are currently generated with:

<Link
  href={`/app/projects/${project.id}/ref/${branch.name}`}
  className={styles.branchName}
>
  {branch.name}
</Link>

When branch names contain slashes (common in Git workflows), the resulting URL path segments are misinterpreted by the router, causing 404 errors.

Proposed Solution

Use the urlgen utility to properly handle special characters in branch names:

  1. Add a route definition for branch detail pages in the routeDefinitions file
  2. Modify the Link component to use urlgen for generating the URL path
  3. This will ensure proper encoding of branch names with special characters

Technical Considerations

  • Branch names with slashes are common in Git (feature/branch, bugfix/issue-123)
  • URL paths should properly encode these special characters
  • The current direct string interpolation doesn't handle this edge case

Implementation Details

  1. Add a route definition for the branch detail page in routeDefinitions.ts
  2. Update the Link component in ProjectBranchesListPage.tsx to use urlgen
  3. Test with branch names containing slashes and other special characters

Related Files

  • frontend/apps/app/features/projects/pages/ProjectBranchesListPage/ProjectBranchesListPage.tsx
  • frontend/apps/app/utils/routes/urlgen.ts
  • frontend/apps/app/utils/routes/routeDefinitions.ts
@MH4GF MH4GF added bug Something isn't working frontend labels Apr 3, 2025
@MH4GF MH4GF changed the title ブランチ名にスラッシュが含まれる場合、ブランチ詳細ページで404エラーが発生する問題 404 error when navigating to branch detail pages with slashes in branch names Apr 3, 2025
Copy link
Contributor

I'm investigating this issue and will submit a PR with a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working frontend
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant