From fa2a3d48759a83548424c37321a3434423764f3d Mon Sep 17 00:00:00 2001 From: JuanJakobo Date: Mon, 13 Mar 2023 21:28:49 +0100 Subject: [PATCH] Fix #32 encode username before using as uuid --- src/api/webDAV.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/api/webDAV.cpp b/src/api/webDAV.cpp index c77336d..2af98b7 100644 --- a/src/api/webDAV.cpp +++ b/src/api/webDAV.cpp @@ -30,12 +30,16 @@ namespace fs = std::experimental::filesystem; std::string WebDAV::getRootPath(bool encode) { string rootPath = Util::getConfig("ex_relativeRootPath", "/"); - if (rootPath == "") + if (rootPath.empty()) + { rootPath += "/"; + } string user = Util::getConfig("UUID", ""); - if (user == "") + if (user.empty()) + { user = Util::getConfig("username", "error"); + } string rtc = NEXTCLOUD_ROOT_PATH + user + rootPath; @@ -79,6 +83,7 @@ std::vector WebDAV::login(const string &Url, const string &Username, _url = Url; uuid = Username; } + Util::encodeUrl(uuid); auto tempPath = NEXTCLOUD_ROOT_PATH + uuid + "/"; Util::writeConfig("storageLocation", "/mnt/ext1/nextcloud"); std::vector tempItems = getDataStructure(tempPath);