Skip to content

fix: enhance repository URL handling in useRepositoryUrl#2144

Closed
imtmh wants to merge 1 commit intonpmx-dev:mainfrom
imtmh:patch-1
Closed

fix: enhance repository URL handling in useRepositoryUrl#2144
imtmh wants to merge 1 commit intonpmx-dev:mainfrom
imtmh:patch-1

Conversation

@imtmh
Copy link

@imtmh imtmh commented Mar 19, 2026

Updated URL construction to strip trailing .git and ensure proper formatting.

🔗 Linked issue

#2142

📚 Description

When constructing repository links for monorepo packages, the .git suffix from the original repository URL was not being removed before appending the /tree/HEAD/{directory} path. This resulted in malformed GitHub URLs that GitHub cannot resolve.

Problem:
For a package like @astrojs/ts-plugin with repository URL https://github.com/withastro/astro.git and directory packages/language-tools/ts-plugin, the link was being constructed as:

Updated URL construction to strip trailing .git and ensure proper formatting.
@vercel
Copy link

vercel bot commented Mar 19, 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 19, 2026 7:13am
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Mar 19, 2026 7:13am
npmx-lunaria Ignored Ignored Mar 19, 2026 7:13am

Request Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 19, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ed6f1eea-d63b-45c4-81d0-8d355db2e77c

📥 Commits

Reviewing files that changed from the base of the PR and between 5d8fcf5 and dbfb68d.

📒 Files selected for processing (1)
  • app/composables/useRepositoryUrl.ts

📝 Walkthrough

Walkthrough

The useRepositoryUrl composable has been updated to improve repository URL normalisation. The change imports withoutTrailingSlash and removes trailing .git (optionally followed by a forward slash) from the normalised repository URL. When a monorepo directory is present, the base URL is additionally processed with withoutTrailingSlash before appending /tree/HEAD and the directory path via joinURL. These modifications ensure the resulting repository URL is correctly formatted when the input ends with .git or contains trailing slashes.

Possibly related PRs

Suggested reviewers

  • MatteoGabriele
🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The pull request description clearly relates to the changeset, explaining the problem of malformed URLs when .git suffix is present and detailing the fix implemented in useRepositoryUrl.

✏️ 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 OpenGrep to find security vulnerabilities and bugs across 17+ programming languages.

OpenGrep is compatible with Semgrep configurations. Add an opengrep.yml or semgrep.yml configuration file to your project to enable OpenGrep analysis.

@codecov
Copy link

codecov bot commented Mar 19, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

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

📢 Thoughts on this report? Let us know!

@imtmh imtmh changed the title Enhance repository URL handling in useRepositoryUrl fix: Enhance repository URL handling in useRepositoryUrl Mar 19, 2026
@imtmh imtmh changed the title fix: Enhance repository URL handling in useRepositoryUrl fix: enhance repository URL handling in useRepositoryUrl Mar 19, 2026
@MatteoGabriele MatteoGabriele added the duplicate This issue or pull request already exists label Mar 19, 2026
@MatteoGabriele
Copy link
Member

Thank you @imtmh, but this has been fixed already, and it will be deployed soon #2113

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

duplicate This issue or pull request already exists

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants