Filter missing files (#403)
This commit is contained in:
parent
47917ddd98
commit
2e87e13347
@ -150,7 +150,7 @@ import qualified Data.ByteString.Lazy as L
|
|||||||
import Network.Wai.Parse (parseHttpAccept)
|
import Network.Wai.Parse (parseHttpAccept)
|
||||||
|
|
||||||
import Yesod.Content
|
import Yesod.Content
|
||||||
import Data.Maybe (fromMaybe)
|
import Data.Maybe (fromMaybe, mapMaybe)
|
||||||
import Web.Cookie (SetCookie (..), renderSetCookie)
|
import Web.Cookie (SetCookie (..), renderSetCookie)
|
||||||
import Control.Arrow ((***))
|
import Control.Arrow ((***))
|
||||||
import qualified Network.Wai.Parse as NWP
|
import qualified Network.Wai.Parse as NWP
|
||||||
@ -348,11 +348,18 @@ rbHelper' :: NWP.BackEnd x
|
|||||||
-> W.Request
|
-> W.Request
|
||||||
-> ResourceT IO ([(Text, Text)], [(Text, FileInfo)])
|
-> ResourceT IO ([(Text, Text)], [(Text, FileInfo)])
|
||||||
rbHelper' backend mkFI req =
|
rbHelper' backend mkFI req =
|
||||||
(map fix1 *** map fix2) <$> (NWP.parseRequestBody backend req)
|
(map fix1 *** mapMaybe fix2) <$> (NWP.parseRequestBody backend req)
|
||||||
where
|
where
|
||||||
fix1 = go *** go
|
fix1 = go *** go
|
||||||
fix2 (x, NWP.FileInfo a b c) =
|
fix2 (x, NWP.FileInfo a' b c)
|
||||||
(go x, mkFI (go a) (go b) c)
|
| S.null a = Nothing
|
||||||
|
| otherwise = Just (go x, mkFI (go a) (go b) c)
|
||||||
|
where
|
||||||
|
a
|
||||||
|
| S.length a' < 2 = a'
|
||||||
|
| S8.head a' == '"' && S8.last a' == '"' = S.tail $ S.init a'
|
||||||
|
| S8.head a' == '\'' && S8.last a' == '\'' = S.tail $ S.init a'
|
||||||
|
| otherwise = a'
|
||||||
go = decodeUtf8With lenientDecode
|
go = decodeUtf8With lenientDecode
|
||||||
|
|
||||||
-- | Get the sub application argument.
|
-- | Get the sub application argument.
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
name: yesod-core
|
name: yesod-core
|
||||||
version: 1.1.0
|
version: 1.1.0.1
|
||||||
license: MIT
|
license: MIT
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Michael Snoyman <michael@snoyman.com>
|
author: Michael Snoyman <michael@snoyman.com>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user