[MM-62762] Make config location in Support Packet human-readable (#30027)
Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
b2b956c043
Коммит
d3dcc74e5a
@@ -108,11 +108,19 @@ func SanitizeDataSource(driverName, dataSource string) (string, error) {
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
u.User = url.UserPassword("****", "****")
|
u.User = url.UserPassword("****", "****")
|
||||||
|
|
||||||
|
// Remove username and password from query string
|
||||||
params := u.Query()
|
params := u.Query()
|
||||||
params.Del("user")
|
params.Del("user")
|
||||||
params.Del("password")
|
params.Del("password")
|
||||||
u.RawQuery = params.Encode()
|
u.RawQuery = params.Encode()
|
||||||
return u.String(), nil
|
|
||||||
|
// Unescape the URL to make it human-readable
|
||||||
|
out, err := url.QueryUnescape(u.String())
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
case model.DatabaseDriverMysql:
|
case model.DatabaseDriverMysql:
|
||||||
cfg, err := mysql.ParseDSN(dataSource)
|
cfg, err := mysql.ParseDSN(dataSource)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -72,13 +72,21 @@ func TestSanitizeDataSource(t *testing.T) {
|
|||||||
Original string
|
Original string
|
||||||
Sanitized string
|
Sanitized string
|
||||||
}{
|
}{
|
||||||
|
{
|
||||||
|
"",
|
||||||
|
"//****:****@",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"postgres://mmuser:mostest@localhost",
|
||||||
|
"postgres://****:****@localhost",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"postgres://mmuser:mostest@localhost/dummy?sslmode=disable",
|
"postgres://mmuser:mostest@localhost/dummy?sslmode=disable",
|
||||||
"postgres://%2A%2A%2A%2A:%2A%2A%2A%2A@localhost/dummy?sslmode=disable",
|
"postgres://****:****@localhost/dummy?sslmode=disable",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"postgres://localhost/dummy?sslmode=disable&user=mmuser&password=mostest",
|
"postgres://localhost/dummy?sslmode=disable&user=mmuser&password=mostest",
|
||||||
"postgres://%2A%2A%2A%2A:%2A%2A%2A%2A@localhost/dummy?sslmode=disable",
|
"postgres://****:****@localhost/dummy?sslmode=disable",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
driver := model.DatabaseDriverPostgres
|
driver := model.DatabaseDriverPostgres
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user