This commit is contained in:
Unknown 2014-07-12 00:55:19 -04:00
parent 63cc14062a
commit 0f907301b7
9 changed files with 48 additions and 15 deletions

View file

@ -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
}

View file

@ -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
}