forked from GitHub/gf-core
use cannonicalizePath in getFilePathMsg. This returns an absolute path and removes the .. indirection
This commit is contained in:
@@ -104,8 +104,10 @@ getFilePathMsg msg paths file = get paths where
|
|||||||
get (p:ps) = do
|
get (p:ps) = do
|
||||||
let pfile = p </> file
|
let pfile = p </> file
|
||||||
exist <- doesFileExist pfile
|
exist <- doesFileExist pfile
|
||||||
if exist then return (Just pfile) else get ps
|
if not exist
|
||||||
--- catch (readFileStrict pfile >> return (Just pfile)) (\_ -> get ps)
|
then get ps
|
||||||
|
else do pfile <- canonicalizePath pfile
|
||||||
|
return (Just pfile)
|
||||||
|
|
||||||
readFileIfPath :: [FilePath] -> String -> IOE (FilePath,BS.ByteString)
|
readFileIfPath :: [FilePath] -> String -> IOE (FilePath,BS.ByteString)
|
||||||
readFileIfPath paths file = do
|
readFileIfPath paths file = do
|
||||||
|
|||||||
Reference in New Issue
Block a user