Merge pull request #12678 from yogyrahmawan/escape_postgres_parameters

postgres; escape ssl mode parameter
This commit is contained in:
Marcus Efraimsson 2018-07-24 11:15:21 +02:00 committed by GitHub
commit 05da21c6d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -53,7 +53,13 @@ func generateConnectionString(datasource *models.DataSource) string {
}
sslmode := datasource.JsonData.Get("sslmode").MustString("verify-full")
u := &url.URL{Scheme: "postgres", User: url.UserPassword(datasource.User, password), Host: datasource.Url, Path: datasource.Database, RawQuery: "sslmode=" + sslmode}
u := &url.URL{
Scheme: "postgres",
User: url.UserPassword(datasource.User, password),
Host: datasource.Url, Path: datasource.Database,
RawQuery: "sslmode=" + url.QueryEscape(sslmode),
}
return u.String()
}