diff options
| author | LLLL Colonq <llll@colonq> | 2024-01-12 21:49:13 -0500 |
|---|---|---|
| committer | LLLL Colonq <llll@colonq> | 2024-01-12 21:49:13 -0500 |
| commit | b27c50d962c43dfc3660d28fc0a096966c5a1066 (patch) | |
| tree | d5f8f516e9dfbecc8dbb78ae34df17c4dc2eb28e /fig-frontend | |
| parent | e5f5c42f69448ac5d9fa71dac9d41d64c7165643 (diff) | |
Downcase user names
Diffstat (limited to 'fig-frontend')
| -rw-r--r-- | fig-frontend/src/Fig/Frontend.hs | 4 |
1 files changed, 3 insertions, 1 deletions
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 |
