fix and refactor
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
This commit is contained in:
parent
8c1c91e02b
commit
eec2d2e9a9
@ -1681,28 +1681,22 @@ auto remote_server::json_release_directory_snapshot(
|
|||||||
|
|
||||||
auto remote_server::update_to_windows_format(const std::string &root_api_path,
|
auto remote_server::update_to_windows_format(const std::string &root_api_path,
|
||||||
json &item) -> json & {
|
json &item) -> json & {
|
||||||
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
auto api_path = item[JSON_API_PATH].get<std::string>();
|
auto api_path = item[JSON_API_PATH].get<std::string>();
|
||||||
if (api_path == ".") {
|
if (api_path == "." || api_path == "..") {
|
||||||
api_path = root_api_path;
|
auto orig_api_path{api_path};
|
||||||
|
|
||||||
|
api_path = api_path == "."
|
||||||
|
? root_api_path
|
||||||
|
: utils::path::get_parent_api_path(root_api_path);
|
||||||
|
|
||||||
api_meta_map meta;
|
api_meta_map meta;
|
||||||
auto res = drive_.get_item_meta(api_path, meta);
|
auto res = drive_.get_item_meta(api_path, meta);
|
||||||
if (res != api_error::success) {
|
if (res != api_error::success) {
|
||||||
utils::error::raise_api_path_error(function_name, api_path, res,
|
utils::error::raise_api_path_error(
|
||||||
"failed to get . meta");
|
function_name, api_path, res,
|
||||||
return item;
|
fmt::format("failed to get '{}' meta", orig_api_path));
|
||||||
}
|
|
||||||
|
|
||||||
item[JSON_META] = meta;
|
|
||||||
} else if (api_path == "..") {
|
|
||||||
// TODO handle '/' parent
|
|
||||||
api_path = utils::path::get_parent_api_path(root_api_path);
|
|
||||||
|
|
||||||
api_meta_map meta;
|
|
||||||
auto res = drive_.get_item_meta(api_path, meta);
|
|
||||||
if (res != api_error::success) {
|
|
||||||
utils::error::raise_api_path_error(function_name, api_path, res,
|
|
||||||
"failed to get .. meta");
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user