Skip to content
Snippets Groups Projects
Commit 3f905289 authored by Adam Harrison's avatar Adam Harrison Committed by Will Rouesnel
Browse files

URL encode username/password fields

Fixes #188.
parent 9eff17a2
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -1086,8 +1086,9 @@ func getDataSource() string {
pass = os.Getenv("DATA_SOURCE_PASS")
}
 
ui := url.UserPassword(user, pass).String()
uri := os.Getenv("DATA_SOURCE_URI")
dsn = "postgresql://" + user + ":" + pass + "@" + uri
dsn = "postgresql://" + ui + "@" + uri
}
 
return dsn
Loading
Loading
Loading
Loading
@@ -105,7 +105,7 @@ func (s *FunctionalSuite) TestEnvironmentSettingWithSecretsFiles(c *C) {
c.Assert(err, IsNil)
defer UnsetEnvironment(c, "DATA_SOURCE_URI")
 
var expected = "postgresql://custom_username:custom_password@localhost:5432/?sslmode=disable"
var expected = "postgresql://custom_username$&+,%2F%3A;=%3F%40:custom_password$&+,%2F%3A;=%3F%40@localhost:5432/?sslmode=disable"
 
dsn := getDataSource()
if dsn != expected {
Loading
Loading
custom_username
custom_username$&+,/:;=?@
custom_password
custom_password$&+,/:;=?@
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment