fix - don't check msg size for binary

This commit is contained in:
spaced4ndy
2023-12-20 19:12:37 +04:00
parent d2b6494b19
commit b50e772688
2 changed files with 7 additions and 7 deletions
-1
View File
@@ -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) ->
+7 -6
View File
@@ -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"]