fix: only trim trailing .git not any match#1094
Conversation
✅ Deploy Preview for endearing-brigadeiros-63f9d0 canceled.
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1094 +/- ##
==========================================
- Coverage 77.41% 77.40% -0.01%
==========================================
Files 55 55
Lines 2276 2293 +17
Branches 255 258 +3
==========================================
+ Hits 1762 1775 +13
- Misses 484 488 +4
Partials 30 30 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This would be less needed if #1043 goes in soon as we make far far less use of the repoName (still used for display but little else). After that we'll use the full URL with ".git" on the end through the proxy OR |
Currently replacing .git even in the middle of valid repo names. This fix only trims from the back.
Do the same for the trailing .git for the ref/heads/ prefix to be safe and clean things up.
Try to catch any future regressions
e82bf0f to
d268ea6
Compare
|
Rebased |
There was a problem hiding this comment.
LGTM after fixing merge conflicts! Although #1043 might reduce/eliminate the need for these changes, we can release this in GitProxy v1 - excellent for users who will still be using v1 for compatibility/legacy reasons. #1043 can be released with other breaking changes/security improvements in v2.
Thanks for the PR! 👍🏼
Currently .git is being replaced in repoNames but
replaceonly catches the first match from left to rightGit repos can have .git included in the name so to correctly get the repoName without a trailing
.gitit should only be removed from the back (assuming it's there).
Trailing

.gitbeing trimmed by github:.gitbeing allowed mid repo-name:.gitbeing allowed at the start of a repo nameThis code checks the string ends with
.git. If it does it returns the string up to but not including.git, otherwise it returns the whole string.I've added a new test just for this edgecase.