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