fix(ui): strip .git before path/query/fragment in normalizeGitUrl#2235
fix(ui): strip .git before path/query/fragment in normalizeGitUrl#2235tinsever wants to merge 1 commit intonpmx-dev:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
📝 WalkthroughWalkthroughThis pull request updates the Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
test/unit/shared/utils/git-providers.spec.ts (1)
41-46: Add one more regression case for.git/path form.These additions are solid; please also cover the slash-delimiter case from the same rule set to prevent regressions.
Suggested test addition
expect .soft(normalizeGitUrl('git+https://github.com/user/repo.git?path=packages/core')) .toBe('https://github.com/user/repo?path=packages/core') + expect + .soft(normalizeGitUrl('git+https://github.com/user/repo.git/tree/HEAD/packages/core')) + .toBe('https://github.com/user/repo/tree/HEAD/packages/core')
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 3fe23cee-e258-47f1-b5b9-28cef5f64213
📒 Files selected for processing (2)
shared/utils/git-providers.tstest/unit/shared/utils/git-providers.spec.ts
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
🔗 Linked issue
Resolves #2233
🧭 Context
The package page “source” link for some monorepos pointed at URLs like https://github.com/org/repo.git/tree/HEAD/packages/..., which GitHub returns as 404. The same path without .git works. Registry metadata often uses git+https://…repo.git plus optional fragments, query strings, or a trailing slash, so stripping .git only when it was the final characters of the string was not enough.
📚 Description
normalizeGitUrlinshared/utils/git-providers.tsto remove a.gitsuffix when it appears immediately before/,#,?, or end of string (case-insensitive), not only at the absolute end of the URL.git+https://…repo.git#…andgit+https://…repo.git?…so monorepo source links built viauseRepositoryUrl(repo.url+/tree/HEAD+repository.directory) no longer embed.gitin the path.Tests:
test/unit/shared/utils/git-providers.spec.ts— new expectations for fragment and query forms; existing cases still pass.