From 6a7a4f40c33bb5924279c4a2468ab5bab62fa388 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Blin?=
 <sebastien.blin@savoirfairelinux.com>
Date: Thu, 28 Sep 2023 06:39:17 -0400
Subject: [PATCH] conversationrepository: fix regression on vote resolution

737e2f117c97df8b0b65c2f8f337a0224dc8f424 introduces a regression
where "uri.crt" is replaced by "uri/crt", causing incorrect path
and breaking the vote system

Change-Id: Ibe5dff8335c2f989dc1de944c1cc538d4a7f6489
---
 src/jamidht/conversationrepository.cpp | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/jamidht/conversationrepository.cpp b/src/jamidht/conversationrepository.cpp
index 7ad3d1d969..59d3ce2e5b 100644
--- a/src/jamidht/conversationrepository.cpp
+++ b/src/jamidht/conversationrepository.cpp
@@ -3549,11 +3549,11 @@ ConversationRepository::Impl::resolveBan(const std::string_view type, const std:
     auto bannedPath = repoPath / "banned";
     auto devicesPath = repoPath / "devices";
     // Move from device or members file into banned
-    auto crtStr = (type != "invited" ? ".crt" : "");
-    auto originFilePath = repoPath / type / uri / crtStr;
+    auto crtStr = uri + (type != "invited" ? ".crt" : "");
+    auto originFilePath = repoPath / type / crtStr;
 
     auto destPath = bannedPath / type;
-    auto destFilePath = destPath / uri / crtStr;
+    auto destFilePath = destPath / crtStr;
     if (!dhtnet::fileutils::recursive_mkdir(destPath, 0700)) {
         JAMI_ERROR("Error when creating {}. Abort resolving vote", destPath);
         return false;
@@ -3603,10 +3603,10 @@ ConversationRepository::Impl::resolveUnban(const std::string_view type, const st
     auto repo = repository();
     std::filesystem::path repoPath = git_repository_workdir(repo.get());
     auto bannedPath = repoPath / "banned";
-    auto crtStr = (type != "invited" ? ".crt" : "");
-    auto originFilePath = bannedPath / type / uri / crtStr;
+    auto crtStr = uri + (type != "invited" ? ".crt" : "");
+    auto originFilePath = bannedPath / type / crtStr;
     auto destPath = repoPath / type;
-    auto destFilePath = destPath / uri / crtStr;
+    auto destFilePath = destPath / crtStr;
     if (!dhtnet::fileutils::recursive_mkdir(destPath, 0700)) {
         JAMI_ERROR("Error when creating {}. Abort resolving vote", destPath);
         return false;
-- 
GitLab