hashes remain text formats
This commit is contained in:
parent
f9a3490da5
commit
aa7d7e55cb
2 changed files with 6 additions and 3 deletions
|
@ -15,6 +15,8 @@ import Data.ByteString.Builder (byteString)
|
|||
|
||||
import Data.String (fromString)
|
||||
|
||||
import Data.Text.Encoding (encodeUtf8)
|
||||
|
||||
import Servant
|
||||
|
||||
import Network.Wai
|
||||
|
@ -40,7 +42,7 @@ avatarGet aid = do
|
|||
flush
|
||||
) :: Application)
|
||||
else
|
||||
return ((\_ response -> response $ responseStream status200 [(hETag, BS.pack (avatarHash (head as)))] $
|
||||
return ((\_ response -> response $ responseStream status200 [(hETag, encodeUtf8 (avatarHash (head as)))] $
|
||||
\write flush -> do
|
||||
write $ byteString $ BS.pack $ avatarData $ head as
|
||||
flush
|
||||
|
|
|
@ -5,6 +5,7 @@ module Types.Avatar where
|
|||
import Data.ByteString
|
||||
|
||||
import qualified Data.Text as T
|
||||
import Data.Text.Encoding (decodeUtf8)
|
||||
|
||||
import Data.Word (Word8)
|
||||
|
||||
|
@ -18,7 +19,7 @@ import Classes
|
|||
data Avatar = Avatar
|
||||
{ avatarId :: Int
|
||||
, avatarName :: T.Text
|
||||
, avatarHash :: [Word8]
|
||||
, avatarHash :: T.Text
|
||||
, avatarData :: [Word8]
|
||||
}
|
||||
deriving (Show, Generic)
|
||||
|
@ -32,7 +33,7 @@ instance FromDatabase Avatar where
|
|||
type OutTuple Avatar = (Int, T.Text, ByteString, ByteString)
|
||||
|
||||
fromDatabase (id_, name, hash, data_) =
|
||||
Avatar id_ name (unpack hash) (unpack data_)
|
||||
Avatar id_ name (decodeUtf8 hash) (unpack data_)
|
||||
|
||||
|
||||
data AvatarData = AvatarData
|
||||
|
|
Loading…
Reference in a new issue