1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
module Network.Wai.Application.Classic.FileInfo where
import Network.Wai
import Network.Wai.Application.Classic.Path
import Network.Wai.Application.Classic.Types
----------------------------------------------------------------
pathinfoToFilePath :: Request -> FileRoute -> Path
pathinfoToFilePath req filei = path'
where
path = rawPathInfo req
src = fileSrc filei
dst = fileDst filei
path' = dst </> (path <\> src) -- fixme
addIndex :: FileAppSpec -> Path -> Path
addIndex spec path
| hasTrailingPathSeparator path = path </> indexFile spec
| otherwise = path
redirectPath :: FileAppSpec -> Path -> Maybe Path
redirectPath spec path
| hasTrailingPathSeparator path = Nothing
| otherwise = Just (path </> indexFile spec)
|