git.iko.soy/typeable/servant
on master help sign in
Use filepath to add trailing path separator
commit7e14eeafe927c3f78b087c1fd4ad641f92efb1cd authorIlya Smelkov <triplepointfive@gmail.com> dateSat 16 May 2015, 01:03 (11 years ago) parentc412678
2 files changed+5−5
servant-server/servant-server.cabal+2−1 servant-server/src/Servant/Utils/StaticFiles.hs+3−4
servant-server/servant-server.cabal+2−1
@@ -53,10 +53,11 @@ library
5353 , split >= 0.2 && < 0.3
5454 , string-conversions >= 0.3 && < 0.4
5555 , system-filepath >= 0.4 && < 0.5
56+ , filepath >= 1
5657 , text >= 1.2 && < 1.3
5758 , transformers >= 0.3 && < 0.5
5859 , wai >= 3.0 && < 3.1
59− , wai-app-static >= 3.0 && < 3.1
60+ , wai-app-static >= 3.0 && < 3.2
6061 , warp >= 3.0 && < 3.1
6162 hs-source-dirs: src
6263 default-language: Haskell2010
servant-server/src/Servant/Utils/StaticFiles.hs+3−4
@@ -7,7 +7,7 @@ module Servant.Utils.StaticFiles (
77 serveDirectory,
88 ) where
99
10−import Data.List (isSuffixOf)
10+import System.FilePath (addTrailingPathSeparator)
1111import Network.Wai.Application.Static (staticApp, defaultFileServerSettings)
1212import Servant.API.Raw (Raw)
1313import Servant.Server (Server)
@@ -38,8 +38,7 @@ import Filesystem.Path.CurrentOS (decodeString)
3838serveDirectory :: FilePath -> Server Raw
3939serveDirectory =
4040#if MIN_VERSION_wai_app_static(3,1,0)
41− staticApp . defaultFileServerSettings . mkSuff
41+ staticApp . defaultFileServerSettings . addTrailingPathSeparator
4242#else
43− staticApp . defaultFileServerSettings . decodeString . mkSuff
43+ staticApp . defaultFileServerSettings . decodeString . addTrailingPathSeparator
4444#endif
45− where mkSuff x = if "/" `isSuffixOf` x then x else x ++ "/"