mirror of
https://gitee.com/johng/gf
synced 2026-06-06 16:21:40 +08:00
fix issue in configuration string parsing error when there're special chars(especially '?') in redis password
This commit is contained in:
@ -86,7 +86,7 @@ func RemoveConfig(name ...string) {
|
||||
// ConfigFromStr parses and returns config from given str.
|
||||
// Eg: host:port[,db,pass?maxIdle=x&maxActive=x&idleTimeout=x&maxConnLifetime=x]
|
||||
func ConfigFromStr(str string) (config Config, err error) {
|
||||
array, _ := gregex.MatchString(`([^:]+):*(\d*),{0,1}(\d*),{0,1}(.*)\?(.+)`, str)
|
||||
array, _ := gregex.MatchString(`([^:]+):*(\d*),{0,1}(\d*),{0,1}(.*)\?(.+?)`, str)
|
||||
if len(array) == 6 {
|
||||
parse, _ := gstr.Parse(array[5])
|
||||
config = Config{
|
||||
|
||||
Reference in New Issue
Block a user