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