cleanPath tests again
This commit is contained in:
parent
1e8b15acff
commit
0a9df1076e
@ -169,7 +169,10 @@ toWaiApp' :: ( Yesod master
|
|||||||
-> Maybe Key
|
-> Maybe Key
|
||||||
-> W.Application
|
-> W.Application
|
||||||
toWaiApp' y key' env =
|
toWaiApp' y key' env =
|
||||||
yesodDispatch y y id app404 handler405 method (W.pathInfo env) key' env
|
case cleanPath y $ W.pathInfo env of
|
||||||
|
Left pieces -> sendRedirect y pieces env
|
||||||
|
Right pieces ->
|
||||||
|
yesodDispatch y y id app404 handler405 method pieces key' env
|
||||||
where
|
where
|
||||||
app404 = yesodRunner notFound y y Nothing id
|
app404 = yesodRunner notFound y y Nothing id
|
||||||
handler405 route = yesodRunner badMethod y y (Just route) id
|
handler405 route = yesodRunner badMethod y y (Just route) id
|
||||||
|
|||||||
@ -42,6 +42,7 @@ mkYesod "Y" [parseRoutes|
|
|||||||
|
|
||||||
instance Yesod Y where
|
instance Yesod Y where
|
||||||
approot _ = "http://test"
|
approot _ = "http://test"
|
||||||
|
cleanPath _ s@("subsite":_) = Right s
|
||||||
cleanPath _ ["bar", ""] = Right ["bar"]
|
cleanPath _ ["bar", ""] = Right ["bar"]
|
||||||
cleanPath _ ["bar"] = Left ["bar", ""]
|
cleanPath _ ["bar"] = Left ["bar", ""]
|
||||||
cleanPath _ s =
|
cleanPath _ s =
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user