From 8d85e65405caa90e679e67d89c07d965bc36b94b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Skalick=C3=BD?= Date: Thu, 15 Feb 2024 12:01:20 +0100 Subject: [PATCH] Fix info() --- sources/client.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sources/client.cpp b/sources/client.cpp index 9f2e7b2..74a608c 100644 --- a/sources/client.cpp +++ b/sources/client.cpp @@ -460,10 +460,12 @@ namespace WebDAV std::string encode_file_name = href.first_child().value(); std::string resource_path = curl_unescape(encode_file_name.c_str(), static_cast(encode_file_name.length())); auto target_path = target_urn.path(); - auto target_path_without_sep = target_urn.path(); + auto target_path_without_sep = target_path; if (!target_path_without_sep.empty() && target_path_without_sep.back() == '/') target_path_without_sep.resize(target_path_without_sep.length() - 1); - auto resource_path_without_sep = std::string(resource_path, 0, resource_path.rfind('/') + 1); + auto resource_path_without_sep = resource_path; + if (!resource_path_without_sep.empty() && resource_path_without_sep.back() == '/') + resource_path_without_sep.resize(resource_path_without_sep.length() - 1); if (resource_path_without_sep == target_path_without_sep) { auto propstat = response.node().select_node("*[local-name()='propstat']").node();