diff --git a/Web/Heroku/Internal.hs b/Web/Heroku/Internal.hs index 8fdbf18..a9261ab 100644 --- a/Web/Heroku/Internal.hs +++ b/Web/Heroku/Internal.hs @@ -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