mirror of https://github.com/go-gorm/gorm.git
fix panic in function databaseName when there are special characters in password, such as '?', '/'
This commit is contained in:
parent
82d726bbfd
commit
2fe185eb77
|
@ -70,8 +70,8 @@ func (commonDialect) Quote(key string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (commonDialect) databaseName(scope *Scope) string {
|
func (commonDialect) databaseName(scope *Scope) string {
|
||||||
from := strings.Index(scope.db.parent.source, "/") + 1
|
from := strings.LastIndex(scope.db.parent.source, "/") + 1
|
||||||
to := strings.Index(scope.db.parent.source, "?")
|
to := strings.LastIndex(scope.db.parent.source, "?")
|
||||||
if to == -1 {
|
if to == -1 {
|
||||||
to = len(scope.db.parent.source)
|
to = len(scope.db.parent.source)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue