core: fix sending file to empty group (#2191)
This commit is contained in:
parent
b6876712f0
commit
9edbe2e589
@ -1576,7 +1576,7 @@ processChatCommand = \case
|
||||
fileInline = inlineFileMode mc inlineFiles chunks n
|
||||
fileMode = case xftpCfg of
|
||||
Just cfg
|
||||
| fileInline == Just IFMSent || fileSize < minFileSize cfg -> SendFileSMP fileInline
|
||||
| fileInline == Just IFMSent || fileSize < minFileSize cfg || n <= 0 -> SendFileSMP fileInline
|
||||
| otherwise -> SendFileXFTP
|
||||
_ -> SendFileSMP fileInline
|
||||
pure (fileSize, fileMode)
|
||||
@ -1778,7 +1778,9 @@ assertDirectAllowed user dir ct event =
|
||||
_ -> True
|
||||
|
||||
roundedFDCount :: Int -> Int
|
||||
roundedFDCount n = max 4 $ fromIntegral $ (2 :: Integer) ^ (ceiling (logBase 2 (fromIntegral n) :: Double) :: Integer)
|
||||
roundedFDCount n
|
||||
| n <= 0 = 4
|
||||
| otherwise = max 4 $ fromIntegral $ (2 :: Integer) ^ (ceiling (logBase 2 (fromIntegral n) :: Double) :: Integer)
|
||||
|
||||
startExpireCIThread :: forall m. ChatMonad' m => User -> m ()
|
||||
startExpireCIThread user@User {userId} = do
|
||||
|
@ -964,6 +964,9 @@ testAsyncGroupFileTransfer tmp = do
|
||||
|
||||
testXFTPRoundFDCount :: Expectation
|
||||
testXFTPRoundFDCount = do
|
||||
roundedFDCount (-100) `shouldBe` 4
|
||||
roundedFDCount (-1) `shouldBe` 4
|
||||
roundedFDCount 0 `shouldBe` 4
|
||||
roundedFDCount 1 `shouldBe` 4
|
||||
roundedFDCount 2 `shouldBe` 4
|
||||
roundedFDCount 4 `shouldBe` 4
|
||||
|
Loading…
Reference in New Issue
Block a user