Skip to content
Snippets Groups Projects
Commit b627aa9c authored by Sébastien Blin's avatar Sébastien Blin Committed by Adrien Béraud
Browse files

data_transfer: avoid to crash if directory doesn't exist

This fix testReplayConversation

Change-Id: If760f08c31995a84c8818e1d0f4586865cfec5a9
parent 8065504b
Branches
No related tags found
No related merge requests found
...@@ -553,9 +553,10 @@ TransferManager::onIncomingProfile(const std::shared_ptr<dhtnet::ChannelSocket>& ...@@ -553,9 +553,10 @@ TransferManager::onIncomingProfile(const std::shared_ptr<dhtnet::ChannelSocket>&
auto& pimpl = sthis_->pimpl_; auto& pimpl = sthis_->pimpl_;
auto destPath = sthis_->profilePath(uri); auto destPath = sthis_->profilePath(uri);
{ try {
// Move profile to destination path // Move profile to destination path
std::lock_guard lock(dhtnet::fileutils::getFileLock(destPath)); std::lock_guard lock(dhtnet::fileutils::getFileLock(destPath));
dhtnet::fileutils::recursive_mkdir(destPath.parent_path());
std::filesystem::rename(path, destPath); std::filesystem::rename(path, destPath);
if (!pimpl->accountUri_.empty() && uri == pimpl->accountUri_) { if (!pimpl->accountUri_.empty() && uri == pimpl->accountUri_) {
// If this is the account profile, link or copy it to the account profile path // If this is the account profile, link or copy it to the account profile path
...@@ -564,6 +565,8 @@ TransferManager::onIncomingProfile(const std::shared_ptr<dhtnet::ChannelSocket>& ...@@ -564,6 +565,8 @@ TransferManager::onIncomingProfile(const std::shared_ptr<dhtnet::ChannelSocket>&
std::filesystem::copy_file(destPath, pimpl->accountProfilePath_, ec); std::filesystem::copy_file(destPath, pimpl->accountProfilePath_, ec);
} }
} }
} catch (const std::exception& e) {
JAMI_ERROR("{}", e.what());
} }
std::lock_guard lk {pimpl->mapMutex_}; std::lock_guard lk {pimpl->mapMutex_};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment