fix encryption provider
This commit is contained in:
parent
00cfb67b64
commit
67191be78d
@ -65,11 +65,10 @@ private:
|
||||
static void create_item_meta(api_meta_map &meta, bool directory,
|
||||
const api_file &file);
|
||||
|
||||
auto do_directory_operation(
|
||||
const std::string &api_path, bool directory,
|
||||
std::function<api_error(const encrypt_config &cfg,
|
||||
const std::string &source_path)>
|
||||
callback) const -> api_error;
|
||||
auto do_fs_operation(const std::string &api_path, bool directory,
|
||||
std::function<api_error(const encrypt_config &cfg,
|
||||
const std::string &source_path)>
|
||||
callback) const -> api_error;
|
||||
|
||||
auto
|
||||
process_directory_entry(const std::filesystem::directory_entry &dir_entry,
|
||||
|
@ -169,7 +169,7 @@ auto encrypt_provider::create_directory(const std::string &api_path,
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
|
||||
auto encrypt_provider::do_directory_operation(
|
||||
auto encrypt_provider::do_fs_operation(
|
||||
const std::string &api_path, bool directory,
|
||||
std::function<api_error(const encrypt_config &cfg,
|
||||
const std::string &source_path)>
|
||||
@ -180,7 +180,8 @@ auto encrypt_provider::do_directory_operation(
|
||||
auto res =
|
||||
utils::encryption::decrypt_file_path(cfg.encryption_token, source_path);
|
||||
if (res != api_error::success) {
|
||||
return res;
|
||||
return directory ? api_error::directory_not_found
|
||||
: api_error::item_not_found;
|
||||
}
|
||||
}
|
||||
|
||||
@ -189,7 +190,8 @@ auto encrypt_provider::do_directory_operation(
|
||||
if (source_path != cfg.path &&
|
||||
not source_path.starts_with(cfg.path +
|
||||
utils::path::directory_seperator)) {
|
||||
return api_error::directory_not_found;
|
||||
return directory ? api_error::directory_not_found
|
||||
: api_error::item_not_found;
|
||||
}
|
||||
|
||||
auto exists = utils::file::is_file(source_path);
|
||||
@ -256,7 +258,7 @@ auto encrypt_provider::get_directory_item_count(
|
||||
static const auto *function_name = __FUNCTION__;
|
||||
|
||||
std::uint64_t count{};
|
||||
auto res = do_directory_operation(
|
||||
auto res = do_fs_operation(
|
||||
api_path, true,
|
||||
[&api_path, &count](const encrypt_config & /* cfg */,
|
||||
const std::string &source_path) -> api_error {
|
||||
@ -285,7 +287,7 @@ auto encrypt_provider::get_directory_items(const std::string &api_path,
|
||||
-> api_error {
|
||||
static const auto *function_name = __FUNCTION__;
|
||||
|
||||
return do_directory_operation(
|
||||
return do_fs_operation(
|
||||
api_path, true,
|
||||
[this, &list](const encrypt_config &cfg,
|
||||
const std::string &source_path) -> api_error {
|
||||
|
Loading…
x
Reference in New Issue
Block a user