From 06803cb1f143047148e629da84ca84019b58a8e6 Mon Sep 17 00:00:00 2001
From: Adrien Beraud <adrien.beraud@savoirfairelinux.com>
Date: Wed, 12 Jun 2024 11:11:27 -0400
Subject: [PATCH] conversation: add more logs in case of download failure

GitLab: #972
Change-Id: I99b96231864878d4e2a17c8923d7578d9709b4c9
---
 src/jamidht/conversation.cpp | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/jamidht/conversation.cpp b/src/jamidht/conversation.cpp
index 9146ed0ea7..7f176a4dec 100644
--- a/src/jamidht/conversation.cpp
+++ b/src/jamidht/conversation.cpp
@@ -1976,8 +1976,10 @@ Conversation::onFileChannelRequest(const std::string& member,
     auto commit = getCommit(interactionId);
     if (commit == std::nullopt || commit->find("type") == commit->end()
         || commit->find("tid") == commit->end() || commit->find("sha3sum") == commit->end()
-        || commit->at("type") != "application/data-transfer+json")
+        || commit->at("type") != "application/data-transfer+json") {
+        JAMI_WARNING("[Account {:s}] {} requested invalid file transfer commit {}", pimpl_->accountId_, member, interactionId);
         return false;
+    }
 
     auto path = dataTransfer()->path(fileId);
 
@@ -1986,7 +1988,7 @@ Conversation::onFileChannelRequest(const std::string& member,
         if (std::filesystem::is_symlink(path)) {
             dhtnet::fileutils::remove(path, true);
         }
-        JAMI_DEBUG("[Account {:s}] {:s} asked for non existing file {} in {:s}",
+        JAMI_WARNING("[Account {:s}] {:s} asked for non existing file {} in {:s}",
                    pimpl_->accountId_,
                    member,
                    fileId,
@@ -1995,8 +1997,8 @@ Conversation::onFileChannelRequest(const std::string& member,
     }
     // Check that our file is correct before sending
     if (verifyShaSum && commit->at("sha3sum") != fileutils::sha3File(path)) {
-        JAMI_DEBUG(
-            "[Account {:s}] {:s} asked for file {:s} in {:s}, but our version is not complete",
+        JAMI_WARNING(
+            "[Account {:s}] {:s} asked for file {:s} in {:s}, but our version is not complete or corrupted",
             pimpl_->accountId_,
             member,
             fileId,
-- 
GitLab