From b27c50d962c43dfc3660d28fc0a096966c5a1066 Mon Sep 17 00:00:00 2001 From: LLLL Colonq Date: Fri, 12 Jan 2024 21:49:13 -0500 Subject: Downcase user names --- fig-frontend/src/Fig/Frontend.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'fig-frontend/src/Fig/Frontend.hs') diff --git a/fig-frontend/src/Fig/Frontend.hs b/fig-frontend/src/Fig/Frontend.hs index 30e2f46..aff74c8 100644 --- a/fig-frontend/src/Fig/Frontend.hs +++ b/fig-frontend/src/Fig/Frontend.hs @@ -4,6 +4,8 @@ import Fig.Prelude import Control.Lens (use) +import Data.Text (toLower) + -- import qualified Network.Wai.Middleware.Static as Wai.Static import qualified Network.Wai.Handler.Warp as Warp @@ -49,7 +51,7 @@ app cfg = do buf <- withState st $ use buffer Tw.send $ Tw.text buf , Tw.get "/api/user/:name" do - name <- Tw.param "name" + name <- toLower <$> Tw.param "name" DB.get db ("user:" <> encodeUtf8 name) >>= \case Nothing -> Tw.send . Tw.status Tw.status404 $ Tw.text "user not found" Just val -> Tw.send . Tw.text $ decodeUtf8 val -- cgit v1.2.3