This commit is contained in:
Scott E. Graves 2023-12-13 14:50:19 -06:00
parent d6d4b579c9
commit 883968f53e

View File

@ -505,7 +505,6 @@ auto encrypt_provider::process_directory_entry(
api_parent = row->get_column("api_path").get_value<std::string>(); api_parent = row->get_column("api_path").get_value<std::string>();
} }
if (api_path_data.empty() || api_parent.empty()) {
if (api_parent.empty()) { if (api_parent.empty()) {
api_parent = add_directory(relative_path.parent_path()); api_parent = add_directory(relative_path.parent_path());
} }
@ -516,8 +515,8 @@ auto encrypt_provider::process_directory_entry(
relative_path.filename().string(), dir_entry.path().string(), relative_path.filename().string(), dir_entry.path().string(),
stop_requested, cfg.encryption_token, stop_requested, cfg.encryption_token,
relative_path.parent_path().string()); relative_path.parent_path().string());
api_path = utils::path::create_api_path( api_path = utils::path::create_api_path(api_parent + "/" +
api_parent + "/" + reader.get_encrypted_file_name()); reader.get_encrypted_file_name());
auto iv_list = reader.get_iv_list(); auto iv_list = reader.get_iv_list();
json data = { json data = {
@ -525,8 +524,7 @@ auto encrypt_provider::process_directory_entry(
{"iv_list", iv_list}, {"iv_list", iv_list},
{"original_file_size", dir_entry.file_size()}, {"original_file_size", dir_entry.file_size()},
}; };
auto ins_res = auto ins_res = db::db_insert{*db_, file_table}
db::db_insert{*db_, file_table}
.column_value("source_path", dir_entry.path().string()) .column_value("source_path", dir_entry.path().string())
.column_value("data", data.dump()) .column_value("data", data.dump())
.go(); .go();
@ -537,11 +535,8 @@ auto encrypt_provider::process_directory_entry(
.column_value("source_path", dir_entry.path().string()) .column_value("source_path", dir_entry.path().string())
.go(); .go();
// TODO handle error // TODO handle error
event_system::instance().raise<filesystem_item_added>( event_system::instance().raise<filesystem_item_added>(api_path,
api_path, api_parent, false); api_parent, false);
} else {
api_path = json::parse(api_path_data)["api_path"].get<std::string>();
}
} else { } else {
api_path = json::parse(api_path_data)["api_path"].get<std::string>(); api_path = json::parse(api_path_data)["api_path"].get<std::string>();
} }