@@ -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 ++ "/"