mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-09-26 02:24:54 +00:00
fix - don't check msg size for binary
This commit is contained in:
@@ -3709,7 +3709,6 @@ processAgentMessageConn user@User {userId} corrId agentConnId agentMessage = do
|
||||
checkIntegrityCreateItem (CDGroupRcv gInfo m) msgMeta `catchChatError` \_ -> pure ()
|
||||
cmdId <- createAckCmd conn
|
||||
let aChatMsgs = parseChatMessages msgBody
|
||||
when (length aChatMsgs > 1) $ liftIO $ putStrLn (show msgBody)
|
||||
withAckMessage agentConnId cmdId msgMeta $ do
|
||||
forM_ aChatMsgs $ \case
|
||||
Right (ACMsg _ chatMsg) ->
|
||||
|
||||
@@ -490,12 +490,13 @@ maxChatMsgSize = 15610
|
||||
|
||||
encodeChatMessage :: MsgEncodingI e => ChatMessage e -> Either String ByteString
|
||||
encodeChatMessage msg = do
|
||||
let body = case chatToAppMessage msg of
|
||||
AMJson m -> LB.toStrict $ J.encode m
|
||||
AMBinary m -> strEncode m
|
||||
if B.length body > maxChatMsgSize
|
||||
then Left "large message"
|
||||
else Right body
|
||||
case chatToAppMessage msg of
|
||||
AMJson m -> do
|
||||
let body = LB.toStrict $ J.encode m
|
||||
if B.length body > maxChatMsgSize
|
||||
then Left "large message"
|
||||
else Right body
|
||||
AMBinary m -> Right $ strEncode m
|
||||
|
||||
parseChatMessages :: ByteString -> [Either String AChatMessage]
|
||||
parseChatMessages "" = [Left "empty string"]
|
||||
|
||||
Reference in New Issue
Block a user