diff --git a/src/data_transfer.cpp b/src/data_transfer.cpp
index b72252738a31b8bbf4cd836bd6ddcc98d4c5bc34..3daad27a5057f86bfd60a0a43a78a49f80d21b71 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 0a5a09f8c26085692bda7cddb4ecccee10ac5afa..5d6493e2832fc3ecfa3f778282af7491b59ed1f1 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;