Skip to content

Commit

Permalink
Fix #32 encode username before using as uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
JuanJakobo committed Mar 13, 2023
1 parent 9c04d18 commit fa2a3d4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/api/webDAV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,16 @@ namespace fs = std::experimental::filesystem;

std::string WebDAV::getRootPath(bool encode) {
string rootPath = Util::getConfig<std::string>("ex_relativeRootPath", "/");
if (rootPath == "")
if (rootPath.empty())
{
rootPath += "/";
}

string user = Util::getConfig<std::string>("UUID", "");
if (user == "")
if (user.empty())
{
user = Util::getConfig<std::string>("username", "error");
}

string rtc = NEXTCLOUD_ROOT_PATH + user + rootPath;

Expand Down Expand Up @@ -79,6 +83,7 @@ std::vector<WebDAVItem> WebDAV::login(const string &Url, const string &Username,
_url = Url;
uuid = Username;
}
Util::encodeUrl(uuid);
auto tempPath = NEXTCLOUD_ROOT_PATH + uuid + "/";
Util::writeConfig<string>("storageLocation", "/mnt/ext1/nextcloud");
std::vector<WebDAVItem> tempItems = getDataStructure(tempPath);
Expand Down

0 comments on commit fa2a3d4

Please sign in to comment.