Permalink
Browse files

Merge pull request #397 from joehillen/_go-createPage

Create page if no match is found when using _go
  • Loading branch information...
2 parents 0adeb2b + 1328545 commit d4d5420a9474ae84a6f438cc3c58b16728b16f9d @jgm committed Feb 10, 2014
Showing with 2 additions and 6 deletions.
  1. +2 −6 Network/Gitit/Handlers.hs
View
8 Network/Gitit/Handlers.hs
@@ -242,19 +242,15 @@ goToPage = withData $ \(params :: Params) -> do
let findPage f = find f allPageNames
let exactMatch f = gotopage == f
let insensitiveMatch f = (map toLower gotopage) == (map toLower f)
- let prefixMatch f = (map toLower gotopage) `isPrefixOf` (map toLower f)
base' <- getWikiBase
case findPage exactMatch of
Just m -> seeOther (base' ++ urlForPage m) $ toResponse
"Redirecting to exact match"
Nothing -> case findPage insensitiveMatch of
Just m -> seeOther (base' ++ urlForPage m) $ toResponse
"Redirecting to case-insensitive match"
- Nothing -> case findPage prefixMatch of
- Just m -> seeOther (base' ++ urlForPage m) $
- toResponse $ "Redirecting" ++
- " to partial match"
- Nothing -> searchResults
+ Nothing -> seeOther (base' ++ urlForPage gotopage) $ toResponse
+ "Redirecting to new page"
searchResults :: Handler
searchResults = withData $ \(params :: Params) -> do

0 comments on commit d4d5420

Please sign in to comment.