Browse Source

Mirror bug fix

pull/77/head
Unknown 11 years ago
parent
commit
d305448fa8
  1. 2
      models/repo.go
  2. 4
      modules/base/conf.go
  3. 4
      routers/install.go
  4. 4
      routers/repo/commit.go

2
models/repo.go

@ -192,9 +192,11 @@ func CreateRepository(user *User, repoName, desc, repoLang, license string, priv
return nil, err return nil, err
} }
if !repo.IsPrivate {
if err = NewRepoAction(user, repo); err != nil { if err = NewRepoAction(user, repo); err != nil {
log.Error("repo.CreateRepository(NewRepoAction): %v", err) log.Error("repo.CreateRepository(NewRepoAction): %v", err)
} }
}
if err = WatchRepo(user.Id, repo.Id, true); err != nil { if err = WatchRepo(user.Id, repo.Id, true); err != nil {
log.Error("repo.CreateRepository(WatchRepo): %v", err) log.Error("repo.CreateRepository(WatchRepo): %v", err)

4
modules/base/conf.go

@ -302,9 +302,9 @@ func NewConfigContext() {
InstallLock = Cfg.MustBool("security", "INSTALL_LOCK", false) InstallLock = Cfg.MustBool("security", "INSTALL_LOCK", false)
RunUser = Cfg.MustValue("", "RUN_USER") RunUser = Cfg.MustValue("", "RUN_USER")
curUser := os.Getenv("USERNAME") curUser := os.Getenv("USER")
if len(curUser) == 0 { if len(curUser) == 0 {
curUser = os.Getenv("USER") curUser = os.Getenv("USERNAME")
} }
// Does not check run user when the install lock is off. // Does not check run user when the install lock is off.
if InstallLock && RunUser != curUser { if InstallLock && RunUser != curUser {

4
routers/install.go

@ -146,9 +146,9 @@ func InstallPost(ctx *middleware.Context, form auth.InstallForm) {
} }
// Check run user. // Check run user.
curUser := os.Getenv("USERNAME") curUser := os.Getenv("USER")
if len(curUser) == 0 { if len(curUser) == 0 {
curUser = os.Getenv("USER") curUser = os.Getenv("USERNAME")
} }
// Does not check run user when the install lock is off. // Does not check run user when the install lock is off.
if form.RunUser != curUser { if form.RunUser != curUser {

4
routers/repo/commit.go

@ -52,6 +52,10 @@ func Commits(ctx *middleware.Context, params martini.Params) {
//both `git log branchName` and `git log commitId` work //both `git log branchName` and `git log commitId` work
commits, err := models.GetCommitsByRange(repoPath, branchName, page) commits, err := models.GetCommitsByRange(repoPath, branchName, page)
if err != nil {
ctx.Handle(500, "repo.Commits(get commits)", err)
return
}
ctx.Data["Username"] = userName ctx.Data["Username"] = userName
ctx.Data["Reponame"] = repoName ctx.Data["Reponame"] = repoName

Loading…
Cancel
Save