From 2fe185eb77a22a3dbdb42cebed976598162ec294 Mon Sep 17 00:00:00 2001 From: liudan Date: Tue, 28 Jul 2015 16:33:32 +0800 Subject: [PATCH] fix panic in function databaseName when there are special characters in password, such as '?', '/' --- common_dialect.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common_dialect.go b/common_dialect.go index 281df8a7..3b646869 100644 --- a/common_dialect.go +++ b/common_dialect.go @@ -70,8 +70,8 @@ func (commonDialect) Quote(key string) string { } func (commonDialect) databaseName(scope *Scope) string { - from := strings.Index(scope.db.parent.source, "/") + 1 - to := strings.Index(scope.db.parent.source, "?") + from := strings.LastIndex(scope.db.parent.source, "/") + 1 + to := strings.LastIndex(scope.db.parent.source, "?") if to == -1 { to = len(scope.db.parent.source) }