Use crypto-conduit 0.1.1's hashFile in base64md5File.
This commit is contained in:
parent
af352c5ed0
commit
59c3705f7d
@ -57,7 +57,7 @@ import Data.List (intercalate)
|
|||||||
import Language.Haskell.TH
|
import Language.Haskell.TH
|
||||||
import Language.Haskell.TH.Syntax
|
import Language.Haskell.TH.Syntax
|
||||||
|
|
||||||
import Crypto.Conduit (sinkHash)
|
import Crypto.Conduit (hashFile)
|
||||||
import Crypto.Hash.MD5 (MD5)
|
import Crypto.Hash.MD5 (MD5)
|
||||||
|
|
||||||
import qualified Data.ByteString.Lazy as L
|
import qualified Data.ByteString.Lazy as L
|
||||||
@ -314,9 +314,8 @@ mkStaticFilesList fp fs routeConName makeHash = do
|
|||||||
]
|
]
|
||||||
|
|
||||||
base64md5File :: Prelude.FilePath -> IO String
|
base64md5File :: Prelude.FilePath -> IO String
|
||||||
base64md5File file = do
|
base64md5File = fmap (base64 . encode) . hashFile
|
||||||
hash <- C.runResourceT $ CB.sourceFile file C.$$ sinkHash
|
where encode d = Data.Serialize.encode (d :: MD5)
|
||||||
return $ base64 $ Data.Serialize.encode (hash :: MD5)
|
|
||||||
|
|
||||||
base64 :: MD5Digest -> String
|
base64 :: MD5Digest -> String
|
||||||
base64 = map tr
|
base64 = map tr
|
||||||
|
|||||||
@ -40,7 +40,7 @@ library
|
|||||||
, http-types >= 0.6.5 && < 0.7
|
, http-types >= 0.6.5 && < 0.7
|
||||||
, unix-compat >= 0.2
|
, unix-compat >= 0.2
|
||||||
, conduit >= 0.0
|
, conduit >= 0.0
|
||||||
, crypto-conduit >= 0.1 && < 0.2
|
, crypto-conduit >= 0.1.1 && < 0.2
|
||||||
, cryptohash >= 0.6.1
|
, cryptohash >= 0.6.1
|
||||||
exposed-modules: Yesod.Static
|
exposed-modules: Yesod.Static
|
||||||
ghc-options: -Wall
|
ghc-options: -Wall
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user