summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2017-03-16 17:47:07 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2017-03-16 17:47:07 +0100
commit089ba7d7f860022780da9d426207dc7fe3507a55 (patch)
treea02b2c8b46f2a627cb979d1f76807b4b647c3dca
parent6cf1b9b7bbca3d6598f9504ab4cb48c2b4677c76 (diff)
downloadbar-089ba7d7f860022780da9d426207dc7fe3507a55.tar
bar-089ba7d7f860022780da9d426207dc7fe3507a55.tar.gz
bar-089ba7d7f860022780da9d426207dc7fe3507a55.tar.bz2
bar-089ba7d7f860022780da9d426207dc7fe3507a55.tar.xz
bar-089ba7d7f860022780da9d426207dc7fe3507a55.zip
Roll own cleanPath
-rw-r--r--Foundation.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/Foundation.hs b/Foundation.hs
index d7425d5..8b3fe46 100644
--- a/Foundation.hs
+++ b/Foundation.hs
@@ -123,6 +123,19 @@ instance Yesod App where
123 -- error pages 123 -- error pages
124 defaultMessageWidget title body = $(widgetFile "default-message-widget") 124 defaultMessageWidget title body = $(widgetFile "default-message-widget")
125 125
126 cleanPath _ s = if corrected == s
127 then Right $ filter (not . null) s
128 else Left corrected
129 where
130 corrected = rds s
131
132 rds [] = []
133 rds [x] = [x]
134 rds (x:y:ss)
135 | null x
136 , null y = rds (x:ss)
137 | otherwise = x : rds (y:ss)
138
126-- How to run database actions. 139-- How to run database actions.
127instance YesodPersist App where 140instance YesodPersist App where
128 type YesodPersistBackend App = SqlBackend 141 type YesodPersistBackend App = SqlBackend