2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-05 05:47:17 +08:00

fix: mysql包含特殊字符连接失败

This commit is contained in:
耗子
2025-01-01 21:15:13 +08:00
parent 185f0fdb95
commit 3022c91eb3

View File

@@ -3,7 +3,6 @@ package db
import (
"database/sql"
"fmt"
"net/url"
"regexp"
"slices"
@@ -20,8 +19,6 @@ type MySQL struct {
}
func NewMySQL(username, password, address string, typ ...string) (*MySQL, error) {
username = url.QueryEscape(username)
password = url.QueryEscape(password)
dsn := fmt.Sprintf("%s:%s@tcp(%s)/", username, password, address)
if len(typ) > 0 && typ[0] == "unix" {
dsn = fmt.Sprintf("%s:%s@unix(%s)/", username, password, address)