@@ -19,6 +19,7 @@ import qualified Crypto.Classes as CR
1919import Crypto.Hash.CryptoAPI (hash', MD5)
2020import qualified Data.ByteString.Base64 as B64
2121import WaiAppStatic.Storage.Filesystem (defaultFileServerSettings)
22+import System.FilePath (pathSeparator)
2223
2324-- | Serve the list of path/content pairs directly from memory.
2425embeddedSettings :: [(Prelude.FilePath, ByteString)] -> StaticSettings
@@ -63,7 +64,11 @@ toEmbedded fps =
6364 texts = map (\(x, y) -> (filter (not . T.null . fromPiece) $ toPieces' x, y)) fps
6465 toPieces' "" = []
6566 toPieces' x =
66− let (y, z) = break (== '/') x
67+ -- See https://github.com/yesodweb/yesod/issues/626
68+ --
69+ -- We want to separate on the forward slash on *all* OSes, and on
70+ -- Windows, also separate on a backslash.
71+ let (y, z) = break (\c -> c == '/' || c == pathSeparator) x
6772 in unsafeToPiece (T.pack y) : toPieces' (drop 1 z)
6873
6974 go :: [(Pieces, ByteString)] -> Embedded