From eec2d2e9a9bbdc768b51e569a89d9e156e4ae1b1 Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Wed, 2 Apr 2025 14:05:10 -0500 Subject: [PATCH] fix and refactor --- .../drives/fuse/remotefuse/remote_server.cpp | 28 ++++++++----------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/repertory/librepertory/src/drives/fuse/remotefuse/remote_server.cpp b/repertory/librepertory/src/drives/fuse/remotefuse/remote_server.cpp index f2f77781..0fc6e3cf 100644 --- a/repertory/librepertory/src/drives/fuse/remotefuse/remote_server.cpp +++ b/repertory/librepertory/src/drives/fuse/remotefuse/remote_server.cpp @@ -1681,28 +1681,22 @@ auto remote_server::json_release_directory_snapshot( auto remote_server::update_to_windows_format(const std::string &root_api_path, json &item) -> json & { + REPERTORY_USES_FUNCTION_NAME(); + auto api_path = item[JSON_API_PATH].get(); - if (api_path == ".") { - api_path = root_api_path; + if (api_path == "." || 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; 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; - } - - 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"); + utils::error::raise_api_path_error( + function_name, api_path, res, + fmt::format("failed to get '{}' meta", orig_api_path)); return item; }