From 6b8c3da184ddd2aecfd86df18d6057664351a470 Mon Sep 17 00:00:00 2001 From: Martin Riedel Date: Tue, 11 Jul 2023 22:22:03 -0400 Subject: [PATCH] fix: Webdav href contains absolute URI the id were not set correctly. --- src/webdav.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/webdav.cpp b/src/webdav.cpp index 151497e..e220f0f 100644 --- a/src/webdav.cpp +++ b/src/webdav.cpp @@ -265,7 +265,12 @@ std::vector rfs::WebDav::parseXMLResponse(const std::string& xml) tinyxml2::XMLElement* hrefElem = responseElem->FirstChildElement((nsPrefix + "href").c_str()); if (hrefElem) { - item.id = hrefElem->GetText(); + std::string hrefText = hrefElem->GetText(); + // href can be absolute URI or relative reference. ALWAYS convert to relative reference + if(hrefText.find(origin) == 0) { + item.id = hrefText.substr(origin.length()); + } + item.parent = parentId; } @@ -297,7 +302,7 @@ std::vector rfs::WebDav::parseXMLResponse(const std::string& xml) // first Item is always the parent. if (parentId.empty()) { - parentId = hrefElem->GetText(); + parentId = item.id; continue; // do not push parent to list (we are only interested in the children) }