diff --git a/yesod-form/Yesod/Form/Fields.hs b/yesod-form/Yesod/Form/Fields.hs index 53c2af42..e56db56a 100644 --- a/yesod-form/Yesod/Form/Fields.hs +++ b/yesod-form/Yesod/Form/Fields.hs @@ -539,10 +539,10 @@ fileAFormReq fs = AForm $ \(master, langs) menvs ints -> do Nothing -> (FormMissing, Nothing) Just (_, fenv) -> case Map.lookup name fenv of - Nothing -> + Just (fi:_) -> (FormSuccess fi, Nothing) + _ -> let t = renderMessage master langs MsgValueRequired in (FormFailure [t], Just $ toHtml t) - Just fi -> (FormSuccess fi, Nothing) let fv = FieldView { fvLabel = toHtml $ renderMessage master langs $ fsLabel fs , fvTooltip = fmap (toHtml . renderMessage master langs) $ fsTooltip fs @@ -570,8 +570,8 @@ fileAFormOpt fs = AForm $ \(master, langs) menvs ints -> do Nothing -> (FormMissing, Nothing) Just (_, fenv) -> case Map.lookup name fenv of - Nothing -> (FormSuccess Nothing, Nothing) - Just fi -> (FormSuccess $ Just fi, Nothing) + Just (fi:_) -> (FormSuccess $ Just fi, Nothing) + _ -> (FormSuccess Nothing, Nothing) let fv = FieldView { fvLabel = toHtml $ renderMessage master langs $ fsLabel fs , fvTooltip = fmap (toHtml . renderMessage master langs) $ fsTooltip fs diff --git a/yesod-form/Yesod/Form/Functions.hs b/yesod-form/Yesod/Form/Functions.hs index 7d800033..bce62479 100644 --- a/yesod-form/Yesod/Form/Functions.hs +++ b/yesod-form/Yesod/Form/Functions.hs @@ -224,7 +224,7 @@ postEnv = do else do (p, f) <- runRequestBody let p' = Map.unionsWith (++) $ map (\(x, y) -> Map.singleton x [y]) p - return $ Just (p', Map.fromList f) + return $ Just (p', Map.unionsWith (++) $ map (\(k, v) -> Map.singleton k [v]) f) runFormPostNoToken :: (Html -> MForm sub master (FormResult a, xml)) -> GHandler sub master ((FormResult a, xml), Enctype) runFormPostNoToken form = do diff --git a/yesod-form/Yesod/Form/Types.hs b/yesod-form/Yesod/Form/Types.hs index 9d2f56fc..2f591e27 100644 --- a/yesod-form/Yesod/Form/Types.hs +++ b/yesod-form/Yesod/Form/Types.hs @@ -76,7 +76,7 @@ instance Show Ints where show (IntCons i is) = show i ++ ('-' : show is) type Env = Map.Map Text [Text] -type FileEnv = Map.Map Text FileInfo +type FileEnv = Map.Map Text [FileInfo] type Lang = Text type MForm sub master a = RWST (Maybe (Env, FileEnv), master, [Lang]) Enctype Ints (GHandler sub master) a diff --git a/yesod-form/yesod-form.cabal b/yesod-form/yesod-form.cabal index 6f5afaa6..328a6518 100644 --- a/yesod-form/yesod-form.cabal +++ b/yesod-form/yesod-form.cabal @@ -1,5 +1,5 @@ name: yesod-form -version: 1.1.3 +version: 1.1.4 license: MIT license-file: LICENSE author: Michael Snoyman