wai-app-static 1.3.3.1 → 2.0.0
raw patch · 5 files changed
+8/−14 lines, 5 filesdep −filepathdep ~wai
Dependencies removed: filepath
Dependency ranges changed: wai
Files
- Network/Wai/Application/Static.hs +1/−1
- WaiAppStatic/Storage/Embedded/Runtime.hs +3/−8
- WaiAppStatic/Storage/Embedded/TH.hs +1/−1
- WaiAppStatic/Storage/Filesystem.hs +1/−1
- wai-app-static.cabal +2/−3
Network/Wai/Application/Static.hs view
@@ -85,7 +85,7 @@ Just listing -> do -- directory listings turned on, display it builder <- listing pieces folder- return $ WaiResponse $ W.ResponseBuilder H.status200+ return $ WaiResponse $ W.responseBuilder H.status200 [ ("Content-Type", "text/html; charset=utf-8") ] builder Nothing -> return $ WaiResponse $ W.responseLBS H.status403
WaiAppStatic/Storage/Embedded/Runtime.hs view
@@ -19,7 +19,6 @@ import Crypto.Hash.CryptoAPI (hash', MD5) import qualified Data.ByteString.Base64 as B64 import WaiAppStatic.Storage.Filesystem (defaultFileServerSettings)-import System.FilePath (pathSeparator) -- | Serve the list of path/content pairs directly from memory. embeddedSettings :: [(Prelude.FilePath, ByteString)] -> StaticSettings@@ -51,7 +50,7 @@ toEntry (name, EEFolder{}) = Left name toEntry (name, EEFile bs) = Right File { fileGetSize = S.length bs- , fileToResponse = \s h -> W.ResponseBuilder s h $ fromByteString bs+ , fileToResponse = \s h -> W.responseBuilder s h $ fromByteString bs , fileName = name , fileGetHash = return $ Just $ runHash bs , fileGetModified = Nothing@@ -64,11 +63,7 @@ texts = map (\(x, y) -> (filter (not . T.null . fromPiece) $ toPieces' x, y)) fps toPieces' "" = [] toPieces' x =- -- See https://github.com/yesodweb/yesod/issues/626- --- -- We want to separate on the forward slash on *all* OSes, and on- -- Windows, also separate on a backslash.- let (y, z) = break (\c -> c == '/' || c == pathSeparator) x+ let (y, z) = break (== '/') x in unsafeToPiece (T.pack y) : toPieces' (drop 1 z) go :: [(Pieces, ByteString)] -> Embedded@@ -88,7 +83,7 @@ bsToFile :: Piece -> ByteString -> File bsToFile name bs = File { fileGetSize = S.length bs- , fileToResponse = \s h -> W.ResponseBuilder s h $ fromByteString bs+ , fileToResponse = \s h -> W.responseBuilder s h $ fromByteString bs , fileName = name , fileGetHash = return $ Just $ runHash bs , fileGetModified = Nothing
WaiAppStatic/Storage/Embedded/TH.hs view
@@ -130,7 +130,7 @@ let h' = if embCompressed entry then h ++ [("Content-Encoding", "gzip")] else h- in W.ResponseBuilder s h' $ insertByteString $ embContent entry+ in W.responseBuilder s h' $ insertByteString $ embContent entry -- Usually the fileName should just be the filename not the entire path, -- but we need the whole path to make the lookup within lookupMime
WaiAppStatic/Storage/Filesystem.hs view
@@ -91,7 +91,7 @@ Left (_ :: SomeException) -> return Nothing Right fs | isRegularFile fs -> return $ Just File { fileGetSize = fromIntegral $ fileSize fs- , fileToResponse = \s h -> W.ResponseFile s h (F.encodeString fp) Nothing+ , fileToResponse = \s h -> W.responseFile s h (F.encodeString fp) Nothing , fileName = name , fileGetHash = hashFunc fp , fileGetModified = Just $ modificationTime fs
wai-app-static.cabal view
@@ -1,5 +1,5 @@ name: wai-app-static-version: 1.3.3.1+version: 2.0.0 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>@@ -24,7 +24,7 @@ library build-depends: base >= 4 && < 5- , wai >= 1.3 && < 1.5+ , wai >= 2.0 && < 2.1 , bytestring >= 0.9.1.4 , http-types >= 0.7 , transformers >= 0.2.2@@ -50,7 +50,6 @@ , unordered-containers >= 0.2 , template-haskell >= 2.7 , zlib >= 0.5- , filepath exposed-modules: Network.Wai.Application.Static WaiAppStatic.Storage.Filesystem