Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis pull request updates repository URL handling in two places. shared/utils/git-providers.ts replaces the previous multi-branch normalization with a single-pass normalizeGitUrl that trims input, removes 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)
📝 Coding Plan
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.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 668114a4-b18a-44e2-b608-0195545392e1
📒 Files selected for processing (2)
app/composables/useRepositoryUrl.tsshared/utils/git-providers.ts
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
shared/utils/git-providers.ts (1)
301-303:⚠️ Potential issue | 🔴 CriticalPreserve explicit SSH ports; current rewrite breaks valid remotes.
Line 301 rewrites
host:portintohost/port, so URLs likessh://git@gitlab.example.com:2222/group/repo.gitare malformed and parsed incorrectly.Proposed fix
export function normalizeGitUrl(input: string): string | null { let url = input .trim() .replace(/^git\+/, '') .replace(/\.git$/, '') - .replace(/(^|\/)[^/]+?@/, '$1') // remove "user@" from "ssh://user@host.com:..." - .replace(/(\.[^./]+?):/, '$1/') // change ".com:" to ".com/" from "ssh://user@host.com:..." + if (!url) return null + + // SCP-style: git@host:owner/repo -> https://host/owner/repo + if (/^[^@/\s]+@[^:/\s]+:.+/.test(url)) { + url = url.replace(/^[^@/\s]+@([^:/\s]+):/, 'https://$1/') + } else { + // URL-style: remove optional userinfo only + url = url.replace(/(^|\/\/)[^/@]+@/, '$1') + } + + // Only rewrite host:path when no scheme exists (avoid touching :port) + if (!url.includes('://')) { + url = url.replace(/(\.[^./]+?):/, '$1/') + } + + url = url .replace(/^git:\/\//, 'https://') .replace(/^ssh:\/\//, 'https://') url = url.includes('://') ? url : `https://${url}` return url || null }
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2f46b42b-2208-4bfc-a7a2-009fc7c75efc
📒 Files selected for processing (1)
shared/utils/git-providers.ts
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
🔗 Linked issue
fix #2097
🧭 Context
Ok so, that linked issue already has two PRs, I'm submitting another 😅 This PR uses a function that I've used in publint (and tested), and also copied to vite, which has been working well, so it might be useful to reuse the same code here.
EDIT: Looks like the code didn't handle radicle urls properly (
https://app.radicle.at/nodes/seed.radicle.at/rad:z3nP4yT1PE3m1PxLEzr173sZtJVnT, the colon) but I've updated to handle it, downside of copying snippets I guess 😬📚 Description
This PR introduces a simpler git url normalization code and handles the trailing
.gitbug.