Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

URL-decode before calling 'fromBS' in pathArg. Fixes #175.

  • Loading branch information...
commit f2ec889e8be94076b86c6576be3336347bc13dcf 1 parent 456f2ca
@gregorycollins gregorycollins authored
Showing with 7 additions and 2 deletions.
  1. +1 −1  snap-core.cabal
  2. +6 −1 src/Snap/Internal/Types.hs
View
2  snap-core.cabal
@@ -1,5 +1,5 @@
name: snap-core
-version: 0.9.3.1
+version: 0.10.0
synopsis: Snap: A Haskell Web Framework (core interfaces and types)
description:
View
7 src/Snap/Internal/Types.hs
@@ -43,6 +43,7 @@ import System.Posix.Types (FileOffset)
import Snap.Internal.Exceptions
import Snap.Internal.Http.Types
import Snap.Internal.Iteratee.Debug
+import Snap.Internal.Parsing (urlDecode)
import Snap.Iteratee hiding (map)
import qualified Snap.Types.Headers as H
import Snap.Util.Readable
@@ -511,13 +512,17 @@ path = pathWith (==)
------------------------------------------------------------------------------
-- | Runs a 'Snap' monad action only when the first path component is
-- successfully parsed as the argument to the supplied handler function.
+--
+-- Note that the path segment is url-decoded prior to being passed to 'fromBS';
+-- this is new as of snap-core 0.10.
pathArg :: (Readable a, MonadSnap m)
=> (a -> m b)
-> m b
pathArg f = do
req <- getRequest
let (p,_) = S.break (=='/') (rqPathInfo req)
- a <- fromBS p
+ p' <- maybe mzero return $ urlDecode p
+ a <- fromBS p'
localRequest (updateContextPath $ S.length p) (f a)
Please sign in to comment.
Something went wrong with that request. Please try again.