diff --git a/repertory/librepertory/src/file_manager/file_manager.cpp b/repertory/librepertory/src/file_manager/file_manager.cpp index b9af0c23..209f08fd 100644 --- a/repertory/librepertory/src/file_manager/file_manager.cpp +++ b/repertory/librepertory/src/file_manager/file_manager.cpp @@ -378,30 +378,27 @@ auto file_manager::get_stored_downloads() const -> std::vector { auto file_manager::handle_file_rename(const std::string &from_api_path, const std::string &to_api_path) -> api_error { - auto should_upload{false}; std::string source_path{}; auto file_iter = open_file_lookup_.find(from_api_path); if (file_iter != open_file_lookup_.end()) { source_path = file_iter->second->get_source_path(); } - if (not should_upload) { - should_upload = upload_lookup_.contains(from_api_path); - if (should_upload) { - if (source_path.empty()) { - source_path = upload_lookup_.at(from_api_path)->get_source_path(); - } - } else { - auto result = db::db_select{*db_.get(), upload_table} - .column("source_path") - .where("api_path") - .equals(from_api_path) - .go(); - std::optional row; - should_upload = result.get_row(row) && row.has_value(); - if (should_upload && source_path.empty()) { - source_path = row->get_column("source_path").get_value(); - } + auto should_upload{upload_lookup_.contains(from_api_path)}; + if (should_upload) { + if (source_path.empty()) { + source_path = upload_lookup_.at(from_api_path)->get_source_path(); + } + } else { + auto result = db::db_select{*db_.get(), upload_table} + .column("source_path") + .where("api_path") + .equals(from_api_path) + .go(); + std::optional row; + should_upload = result.get_row(row) && row.has_value(); + if (should_upload && source_path.empty()) { + source_path = row->get_column("source_path").get_value(); } }