From 7dcca7e71990822e2ac683643f93078ba689257d Mon Sep 17 00:00:00 2001 From: Greg Weber Date: Fri, 20 Jun 2014 13:30:21 -0700 Subject: [PATCH] remove the colon from the port --- Web/Heroku/Internal.hs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) 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