Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure RepoPath is lowercased in gitea serv #12668

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions cmd/serv.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ var CmdServ = cli.Command{
}

func setup(logPath string, debug bool) {
if !debug {
_ = log.DelLogger("console")
_ = log.DelLogger("console")
if debug {
_ = log.NewLogger(1000, "console", "console", `{"level":"trace","stacktracelevel":"NONE","stderr":true}`)
}
setting.NewContext()
if debug {
Expand Down Expand Up @@ -117,6 +118,8 @@ func runServ(c *cli.Context) error {
}
println("If this is unexpected, please log in with password and setup Gitea under another user.")
return nil
} else if c.Bool("debug") {
log.Debug("SSH_ORIGINAL_COMMAND: %s", os.Getenv("SSH_ORIGINAL_COMMAND"))
}

words, err := shellquote.Split(cmd)
Expand Down Expand Up @@ -145,6 +148,9 @@ func runServ(c *cli.Context) error {
}
}

// LowerCase and trim the repoPath as that's how they are stored.
repoPath = strings.ToLower(strings.TrimSpace(repoPath))

rr := strings.SplitN(repoPath, "/", 2)
if len(rr) != 2 {
fail("Invalid repository path", "Invalid repository path: %v", repoPath)
Expand Down