Skip to content

fix: url-encode repository directory segments and strip .git suffix (#2100)#2111

Open
munaibh wants to merge 1 commit intonpmx-dev:mainfrom
munaibh:fix/url-encode-repository-directory
Open

fix: url-encode repository directory segments and strip .git suffix (#2100)#2111
munaibh wants to merge 1 commit intonpmx-dev:mainfrom
munaibh:fix/url-encode-repository-directory

Conversation

@munaibh
Copy link

@munaibh munaibh commented Mar 16, 2026

🔗 Linked issue

Closes #2100
close #2097

🧭 Context

Scoped packages (e.g. @tailwindcss/vite) were generating broken repository URLs due to two bugs in the URL construction flow. This incorporates the initial issue raised in the linked issue, but also the suggestion mentioned in the same thread here: #2100 (comment).

📚 Description

  1. The .git suffix not stripped: normalizeGitUrl returned URLs like https://github.com/tailwindlabs/tailwindcss.git, causing .git to appear mid-URL when /tree/HEAD/<directory> was appended.

  2. @ not url-encoded: values like packages/@tailwindcss-vite were appended as they were. The @ was not encoded, but it should have been encoded as %40 to produce a valid URL.

@vercel
Copy link

vercel bot commented Mar 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Mar 16, 2026 9:57pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Mar 16, 2026 9:57pm
npmx-lunaria Ignored Ignored Mar 16, 2026 9:57pm

Request Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 16, 2026

📝 Walkthrough

Walkthrough

This pull request addresses URL encoding for repository paths containing special characters. The useRepositoryUrl composable now URL-encodes individual directory path segments when constructing repository tree URLs. The normalizeGitUrl utility function additionally strips trailing .git suffixes during normalization. Corresponding unit tests verify the encoding behaviour for scoped packages and the .git suffix removal in various URL formats.

Possibly related PRs

Suggested reviewers

  • alexdln
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The pull request implements both objectives from issue #2100: URL-encoding directory segments (@ to %40) and stripping the .git suffix from repository URLs.
Out of Scope Changes check ✅ Passed All changes are directly aligned with issue #2100 objectives: normalizeGitUrl strips .git, useRepositoryUrl encodes path segments, and tests verify both fixes.
Description check ✅ Passed The pull request description directly addresses the changeset by explaining the two bugs fixed: .git suffix stripping and URL-encoding of @ characters in scoped package directories.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can use Trivy to scan for security misconfigurations and secrets in Infrastructure as Code files.

Add a .trivyignore file to your project to customize which findings Trivy reports.

@codecov
Copy link

codecov bot commented Mar 16, 2026

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
app/composables/useRepositoryUrl.ts 0.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

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.

Special characters must be encoded in URLs Github Link redirects to Github 404 page

1 participant