From: James Turner Date: Fri, 1 Jul 2016 08:02:52 +0000 (+0100) Subject: Fix repository test. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=fd7160b2f113345d379b5266ee7233949823de62;p=simgear.git Fix repository test. --- diff --git a/simgear/io/HTTPRepository.cxx b/simgear/io/HTTPRepository.cxx index 42418b60..6a631423 100644 --- a/simgear/io/HTTPRepository.cxx +++ b/simgear/io/HTTPRepository.cxx @@ -405,7 +405,8 @@ public: HTTPDirectory* childDirectory(const std::string& name) { - return _repository->getOrCreateDirectory(relativePath() + "/" + name); + std::string childPath = relativePath().empty() ? name : relativePath() + "/" + name; + return _repository->getOrCreateDirectory(childPath); } void removeOrphans(const string_list& orphans) diff --git a/simgear/io/test_repository.cxx b/simgear/io/test_repository.cxx index 190d7ecd..843c9680 100644 --- a/simgear/io/test_repository.cxx +++ b/simgear/io/test_repository.cxx @@ -256,6 +256,10 @@ public: repoPath = repoPath.substr(0, suffix); } + if (repoPath.find("/") == 0) { // trim leading / + repoPath = repoPath.substr(1); + } + TestRepoEntry* entry = global_repo->findEntry(repoPath); if (!entry) { sendErrorResponse(404, false, "unknown repo path:" + repoPath);