diff --git a/server/common/cache.go b/server/common/cache.go index 7ab22232..397bd72c 100644 --- a/server/common/cache.go +++ b/server/common/cache.go @@ -16,7 +16,7 @@ func (a *AppCache) Get(key interface{}) interface{} { if err != nil { return nil } - value, found := a.Cache.Get(fmt.Sprint(hash)) + value, found := a.Cache.Get(fmt.Sprintf("%d", hash)) if found == false { return nil } diff --git a/server/common/crypto.go b/server/common/crypto.go index 4693d6b0..2d0eb0f6 100644 --- a/server/common/crypto.go +++ b/server/common/crypto.go @@ -172,5 +172,8 @@ func GenerateID(ctx *App) string { if params["token"] != "" { p += "token =>" + params["token"] } + if p == "salt => " + SECRET_KEY { + return "" + } return Hash(p) } diff --git a/server/model/backend/git.go b/server/model/backend/git.go index 0bd99d80..30abd0ab 100644 --- a/server/model/backend/git.go +++ b/server/model/backend/git.go @@ -96,8 +96,8 @@ func (git Git) Init(params map[string]string, app *App) (IBackend, error) { return nil, NewError("Your password doesn't fit in a cookie :/", 500) } - hash := GenerateID(app) - p.basePath = GetAbsolutePath(GitCachePath + "repo_" + fmt.Sprint(hash) + "/") + hash := GenerateID(app) + p.basePath = GetAbsolutePath(GitCachePath + "repo_" + hash + "/") repo, err := g.git.open(p, p.basePath) g.git.repo = repo