diff options
author | Unknown <joe2010xtmf@163.com> | 2014-07-12 00:55:19 -0400 |
---|---|---|
committer | Unknown <joe2010xtmf@163.com> | 2014-07-12 00:55:19 -0400 |
commit | 0f907301b7fbd05faf07bc22b3316ae1093c6724 (patch) | |
tree | 806e40ea6ef651e28563d09526377ed736528c10 /models | |
parent | 63cc14062a891a99a429f2eef0ee90a3f5795f47 (diff) | |
download | gitea-0f907301b7fbd05faf07bc22b3316ae1093c6724.tar.gz gitea-0f907301b7fbd05faf07bc22b3316ae1093c6724.zip |
Fix #285
Diffstat (limited to 'models')
-rw-r--r-- | models/repo.go | 13 | ||||
-rw-r--r-- | models/user.go | 2 |
2 files changed, 11 insertions, 4 deletions
diff --git a/models/repo.go b/models/repo.go index 396e536e4b..fb7bbbd036 100644 --- a/models/repo.go +++ b/models/repo.go @@ -11,6 +11,7 @@ import ( "os" "path" "path/filepath" + "runtime" "sort" "strings" "time" @@ -359,11 +360,17 @@ func initRepository(f string, user *User, repo *Repository, initReadme bool, rep return err } - rp := strings.NewReplacer("\\", "/", " ", "\\ ") + if runtime.GOOS == "windows" { + rp := strings.NewReplacer("\\", "/") + appPath = "\"" + rp.Replace(appPath) + "\"" + } else { + rp := strings.NewReplacer("\\", "/", " ", "\\ ") + appPath = rp.Replace(appPath) + } + // hook/post-update if err := createHookUpdate(filepath.Join(repoPath, "hooks", "update"), - fmt.Sprintf(TPL_UPDATE_HOOK, setting.ScriptType, - rp.Replace(appPath))); err != nil { + fmt.Sprintf(TPL_UPDATE_HOOK, setting.ScriptType, appPath)); err != nil { return err } diff --git a/models/user.go b/models/user.go index 47f1d45f0e..13c9148473 100644 --- a/models/user.go +++ b/models/user.go @@ -500,7 +500,7 @@ func SearchUserByName(key string, limit int) (us []*User, err error) { key = strings.ToLower(key) us = make([]*User, 0, limit) - err = x.Limit(limit).Where("lower_name like '%" + key + "%'").Find(&us) + err = x.Limit(limit).Where("type=0").And("lower_name like '%" + key + "%'").Find(&us) return us, err } |