xftp: return OK on duplicate upload attempt

This commit is contained in:
Evgeny Poberezkin
2024-03-19 13:52:07 +00:00
parent db3bddecca
commit 46e49fa823

View File

@@ -377,7 +377,7 @@ processXFTPRequest HTTP2Body {bodyPart} = \case
t <- asks $ fileTimeout . config
liftIO $ fromMaybe (Left TIMEOUT) <$> timeout t (runExceptT (receiveFile getBody spec) `catchAll_` pure (Left FILE_IO))
where
checkDuplicate = ifM (isJust <$> readTVarIO filePath) (pure $ FRErr DUPLICATE_)
checkDuplicate = ifM (isJust <$> readTVarIO filePath) (pure FROk)
sendServerFile :: FileRec -> RcvPublicDhKey -> M (FileResponse, Maybe ServerFile)
sendServerFile FileRec {senderId, filePath, fileInfo = FileInfo {size}} rDhKey = do
readTVarIO filePath >>= \case