Skip to content

Commit 933cc4d

Browse files
lunnyKN4CK3R
andauthored
Fix push to create with capitalize repo name (#29090) (#29206)
Fix #29073 Backport #29090 Co-authored-by: KN4CK3R <[email protected]>
1 parent fea6bd1 commit 933cc4d

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

cmd/serv.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,16 +216,18 @@ func runServ(c *cli.Context) error {
216216
}
217217
}
218218

219-
// LowerCase and trim the repoPath as that's how they are stored.
220-
repoPath = strings.ToLower(strings.TrimSpace(repoPath))
221-
222219
rr := strings.SplitN(repoPath, "/", 2)
223220
if len(rr) != 2 {
224221
return fail(ctx, "Invalid repository path", "Invalid repository path: %v", repoPath)
225222
}
226223

227-
username := strings.ToLower(rr[0])
228-
reponame := strings.ToLower(strings.TrimSuffix(rr[1], ".git"))
224+
username := rr[0]
225+
reponame := strings.TrimSuffix(rr[1], ".git")
226+
227+
// LowerCase and trim the repoPath as that's how they are stored.
228+
// This should be done after splitting the repoPath into username and reponame
229+
// so that username and reponame are not affected.
230+
repoPath = strings.ToLower(strings.TrimSpace(repoPath))
229231

230232
if alphaDashDotPattern.MatchString(reponame) {
231233
return fail(ctx, "Invalid repo name", "Invalid repo name: %s", reponame)

0 commit comments

Comments
 (0)