diff options
author | zeripath <art27@cantab.net> | 2021-05-03 18:24:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-03 13:24:24 -0400 |
commit | 1b017fe7ca9df5a8c7d7823a1ded897fc324f9d3 (patch) | |
tree | ddb54f489e2d61387dab0813eee38def27beda80 /modules/nosql | |
parent | d11b9fbcce2245592b3f1ebce6766b48fa1422b7 (diff) | |
download | gitea-1b017fe7ca9df5a8c7d7823a1ded897fc324f9d3.tar.gz gitea-1b017fe7ca9df5a8c7d7823a1ded897fc324f9d3.zip |
Fix setting redis db path (#15698)
There is a bug setting the redis db in the common nosql manager whereby the db path
always fails.
This PR fixes this.
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'modules/nosql')
-rw-r--r-- | modules/nosql/manager_redis.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/nosql/manager_redis.go b/modules/nosql/manager_redis.go index d754a0e07d..b4852cecc8 100644 --- a/modules/nosql/manager_redis.go +++ b/modules/nosql/manager_redis.go @@ -152,7 +152,7 @@ func (m *Manager) GetRedisClient(connection string) redis.UniversalClient { opts.Addrs = append(opts.Addrs, strings.Split(uri.Host, ",")...) } if uri.Path != "" { - if db, err := strconv.Atoi(uri.Path); err == nil { + if db, err := strconv.Atoi(uri.Path[1:]); err == nil { opts.DB = db } } @@ -168,7 +168,7 @@ func (m *Manager) GetRedisClient(connection string) redis.UniversalClient { opts.Addrs = append(opts.Addrs, strings.Split(uri.Host, ",")...) } if uri.Path != "" { - if db, err := strconv.Atoi(uri.Path); err == nil { + if db, err := strconv.Atoi(uri.Path[1:]); err == nil { opts.DB = db } } @@ -186,7 +186,7 @@ func (m *Manager) GetRedisClient(connection string) redis.UniversalClient { opts.Addrs = append(opts.Addrs, strings.Split(uri.Host, ",")...) } if uri.Path != "" { - if db, err := strconv.Atoi(uri.Path); err == nil { + if db, err := strconv.Atoi(uri.Path[1:]); err == nil { opts.DB = db } } |