From a9b27fe9b739d14628348a7cc91009ceea73a066 Mon Sep 17 00:00:00 2001 From: Green Sky Date: Sat, 10 Jan 2026 17:13:21 +0100 Subject: [PATCH] prevent the auto accept when file already exists --- plugins/transfer_auto_accept.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/transfer_auto_accept.cpp b/plugins/transfer_auto_accept.cpp index 8e89e4b..512207b 100644 --- a/plugins/transfer_auto_accept.cpp +++ b/plugins/transfer_auto_accept.cpp @@ -8,6 +8,7 @@ #include +#include #include TransferAutoAccept::TransferAutoAccept(ObjectStore2& os, RegistryMessageModelI& rmm, ConfigModelI& conf) : _os(os), _rmm(rmm), _conf(conf) { @@ -77,17 +78,23 @@ void TransferAutoAccept::checkObj(ObjectHandle o) { return; } + const auto save_dir_path = _conf.get_string("TransferAutoAccept", "save_path").value_or("tmp_save_dir"); uint64_t total_size {0u}; if (const auto* si = o.try_get(); si != nullptr) { if (si->file_name.empty()) { return; // bad file } total_size = si->file_size; + if (std::filesystem::exists(std::filesystem::path(save_dir_path) / si->file_name)) { + return; // pre existing, dont auto + } } else if (const auto* ci = o.try_get(); ci != nullptr) { if (ci->file_list.empty() || ci->file_list.front().file_name.empty()) { return; // bad file } total_size = ci->total_size; + + return; // TODO: figure out a collection strategy } //const auto& file_info = h.get();