mirror of
https://github.com/prometheus-community/postgres_exporter
synced 2025-04-24 20:18:04 +00:00
Don't stop generating fingerprint while encountering value with "=" sign (#318)
This commit is contained in:
parent
27d5c9926d
commit
e1428a8330
@ -708,7 +708,7 @@ func parseFingerprint(url string) (string, error) {
|
||||
pairs := strings.Split(dsn, " ")
|
||||
kv := make(map[string]string, len(pairs))
|
||||
for _, pair := range pairs {
|
||||
splitted := strings.Split(pair, "=")
|
||||
splitted := strings.SplitN(pair, "=", 2)
|
||||
if len(splitted) != 2 {
|
||||
return "", fmt.Errorf("malformed dsn %q", dsn)
|
||||
}
|
||||
|
@ -193,6 +193,10 @@ func (s *FunctionalSuite) TestParseFingerprint(c *C) {
|
||||
url: "postgresql://userDsn:passwordDsn@localhost:55432/?sslmode=disabled",
|
||||
fingerprint: "localhost:55432",
|
||||
},
|
||||
{
|
||||
url: "postgresql://userDsn:passwordDsn%3D@localhost:55432/?sslmode=disabled",
|
||||
fingerprint: "localhost:55432",
|
||||
},
|
||||
{
|
||||
url: "port=1234",
|
||||
fingerprint: "localhost:1234",
|
||||
|
Loading…
Reference in New Issue
Block a user