Skip to content

Commit

Permalink
remove the colon from the port
Browse files Browse the repository at this point in the history
  • Loading branch information
gregwebs committed Jun 20, 2014
1 parent 513b7b1 commit 7dcca7e
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions Web/Heroku/Internal.hs
Expand Up @@ -27,16 +27,18 @@ parseDatabaseUrl' scheme durl =
Nothing -> invalid
Just a -> (a, uriPath uri)
(user,password) = userAndPassword auth
in [
(pack "user", user)
-- tail not safe, but should be there on Heroku
,(pack "password", Data.Text.tail password)
,(pack "host", pack $ uriRegName auth)
,(pack "port", pack $ uriPort auth)
in [ (pack "user", user)
-- tail not safe, but should be there on Heroku
, (pack "password", Data.Text.tail password)
, (pack "host", pack $ uriRegName auth)
, (pack "port", pack $ removeColon $ uriPort auth)
-- tail not safe but path should always be there
,(pack "dbname", pack $ Prelude.tail $ path)
, (pack "dbname", pack $ Prelude.tail $ path)
]
where
removeColon (':':port) = port
removeColon port = port

-- init is not safe, but should be there on Heroku
userAndPassword :: URIAuth -> (Text, Text)
userAndPassword = (breakOn $ pack ":") . pack . Prelude.init . uriUserInfo
Expand Down

0 comments on commit 7dcca7e

Please sign in to comment.