Skip to content

Commit 96ad1d6

Browse files
authored
Fix push to create with capitalize repo name (go-gitea#29090)
Fix go-gitea#29073
1 parent e600c35 commit 96ad1d6

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)