Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

use system-filepath ro decode filename for file serve #152

Open
wants to merge 4 commits into from

1 participant

@cvb

Me, again, I changed utf8-string to system-filepath, and as simplest solution, I use it to convert ByteString to System.IO.FilePath in getSafePath, because you still need path as string for System.Directory.

Is this enough or I should get rid of System.FilePath functions where it is posible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 13, 2012
Commits on Nov 18, 2012
  1. merge original snap master

    cvb authored
Commits on Dec 3, 2012
  1. fix dependency

    cvb authored
This page is out of date. Refresh to see the latest.
View
3  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,
View
2  src/Snap/Internal/Parsing.hs
@@ -161,7 +161,7 @@ pQuotedString = q *> quotedText <* q
, pure soFar' ]
q = char '\"'
- qdtext = matchAll [ isRFCText, (/= '\"'), (/= '\\') ]
+ qdtext = matchAll [ (/= '\"'), (/= '\\') ]
------------------------------------------------------------------------------
View
3  src/Snap/Util/FileServe.hs
@@ -53,6 +53,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
@@ -69,7 +70,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
Something went wrong with that request. Please try again.