From a3197be124b5c67ad608ec0b83a1955237b1fa8f Mon Sep 17 00:00:00 2001 From: cvb Date: Fri, 13 Jul 2012 17:12:29 +0400 Subject: [PATCH 1/3] use system-filesystem to convert bytestring -> string in fileserve --- snap-core.cabal | 3 ++- src/Snap/Util/FileServe.hs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/snap-core.cabal b/snap-core.cabal index d57ede4d..54aae900 100644 --- a/snap-core.cabal +++ b/snap-core.cabal @@ -156,7 +156,8 @@ Library unix-compat >= 0.2 && <0.4, unordered-containers >= 0.1.4.3 && <0.3, vector >= 0.6 && <0.10, - zlib-enum >= 0.2.1 && <0.3 + zlib-enum >= 0.2.1 && <0.3, + system-filepath == 0.4.* extensions: BangPatterns, diff --git a/src/Snap/Util/FileServe.hs b/src/Snap/Util/FileServe.hs index 7cf8dafb..95ac8570 100644 --- a/src/Snap/Util/FileServe.hs +++ b/src/Snap/Util/FileServe.hs @@ -49,6 +49,7 @@ import qualified Prelude import System.Directory import System.FilePath import System.PosixCompat.Files +import qualified Filesystem.Path.CurrentOS as FP ------------------------------------------------------------------------------ import Snap.Core import Snap.Internal.Debug @@ -65,7 +66,7 @@ getSafePath = do req <- getRequest let mp = urlDecode $ rqPathInfo req - p <- maybe pass (return . S.unpack) mp + p <- maybe pass (return . FP.encodeString . FP.decode) mp -- relative paths only! when (not $ isRelative p) pass From 6ea90806e502881d6bdbe3365db5610e94c337d9 Mon Sep 17 00:00:00 2001 From: cvb Date: Fri, 6 Jul 2012 19:06:04 +0400 Subject: [PATCH 2/3] remove check for non control character in params parser --- src/Snap/Internal/Parsing.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Snap/Internal/Parsing.hs b/src/Snap/Internal/Parsing.hs index 6a03adae..be67e34f 100644 --- a/src/Snap/Internal/Parsing.hs +++ b/src/Snap/Internal/Parsing.hs @@ -161,7 +161,7 @@ pQuotedString = q *> quotedText <* q , pure soFar' ] q = char '\"' - qdtext = matchAll [ isRFCText, (/= '\"'), (/= '\\') ] + qdtext = matchAll [ (/= '\"'), (/= '\\') ] ------------------------------------------------------------------------------ From d0662058f112dec9eeedbd86778355818faec246 Mon Sep 17 00:00:00 2001 From: cvb Date: Mon, 3 Dec 2012 16:08:48 +0400 Subject: [PATCH 3/3] fix dependency --- snap-core.cabal | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/snap-core.cabal b/snap-core.cabal index ccedb324..a7e8e53e 100644 --- a/snap-core.cabal +++ b/snap-core.cabal @@ -151,7 +151,8 @@ Library unix-compat >= 0.2 && < 0.5, unordered-containers >= 0.1.4.3 && < 0.3, vector >= 0.6 && < 0.11, - zlib-enum >= 0.2.1 && < 0.3 + zlib-enum >= 0.2.1 && < 0.3, + system-filepath == 0.4.* extensions: BangPatterns,