From a118ddfa51d3ce18d65a44a468b4a211bd2d891a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Blin?=
 <sebastien.blin@savoirfairelinux.com>
Date: Tue, 20 Dec 2022 16:29:30 -0500
Subject: [PATCH] syncHistory: fix testProfileReceivedMultiDevice

The directory was not created in /tmp causing the test to fail
(std::rename fails).

Change-Id: Ic583447ec4d8bc7df9c63744cba9d6c096ee9792
---
 src/data_transfer.cpp                     | 2 +-
 test/unitTest/syncHistory/syncHistory.cpp | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/data_transfer.cpp b/src/data_transfer.cpp
index b72252738a..3daad27a50 100644
--- a/src/data_transfer.cpp
+++ b/src/data_transfer.cpp
@@ -508,7 +508,7 @@ TransferManager::onIncomingProfile(const std::shared_ptr<ChannelSocket>& channel
 
     auto recvDir = fmt::format("{:s}/{:s}/vcard/", fileutils::get_cache_dir(), pimpl_->accountId_);
     fileutils::recursive_mkdir(recvDir);
-    info.path =  fmt::format("{:s}/{:s}_{:s}_{}", recvDir, deviceId, uri, tid);
+    info.path =  fmt::format("{:s}{:s}_{:s}_{}", recvDir, deviceId, uri, tid);
 
     auto ifile = std::make_shared<IncomingFile>(std::move(channel), info, "profile.vcf", "");
     auto res = pimpl_->vcards_.emplace(idx, std::move(ifile));
diff --git a/test/unitTest/syncHistory/syncHistory.cpp b/test/unitTest/syncHistory/syncHistory.cpp
index 0a5a09f8c2..5d6493e283 100644
--- a/test/unitTest/syncHistory/syncHistory.cpp
+++ b/test/unitTest/syncHistory/syncHistory.cpp
@@ -996,6 +996,7 @@ END:VCARD";
             if (accountId == aliceId && peerId == bobUri) {
                 bobProfileReceived = true;
                 auto p = std::filesystem::path(bobDest);
+                fileutils::recursive_mkdir(p.parent_path());
                 auto res = std::rename(path.c_str(), bobDest.c_str());
             } else if (accountId == bobId && peerId == aliceUri) {
                 aliceProfileReceived = true;
-- 
GitLab