@@ -7,7 +7,7 @@ module Servant.Utils.StaticFiles (
7 serveDirectory,
7 serveDirectory,
10−import Data.List (isSuffixOf)
10+import System.FilePath (addTrailingPathSeparator)
11import Network.Wai.Application.Static (staticApp, defaultFileServerSettings)
11import Network.Wai.Application.Static (staticApp, defaultFileServerSettings)
12import Servant.API.Raw (Raw)
12import Servant.API.Raw (Raw)
13import Servant.Server (Server)
13import Servant.Server (Server)
@@ -38,8 +38,7 @@ import Filesystem.Path.CurrentOS (decodeString)
38serveDirectory :: FilePath -> Server Raw
38serveDirectory :: FilePath -> Server Raw
39serveDirectory =
39serveDirectory =
40#if MIN_VERSION_wai_app_static(3,1,0)
40#if MIN_VERSION_wai_app_static(3,1,0)
41− staticApp . defaultFileServerSettings . mkSuff
41+ staticApp . defaultFileServerSettings . addTrailingPathSeparator
43− staticApp . defaultFileServerSettings . decodeString . mkSuff
43+ staticApp . defaultFileServerSettings . decodeString . addTrailingPathSeparator
45− where mkSuff x = if "/" `isSuffixOf` x then x else x ++ "/"