From b862cf7e5495bc18f23dfce01f0047362f8d9918 Mon Sep 17 00:00:00 2001 From: James Turner Date: Fri, 1 Jul 2016 09:02:52 +0100 Subject: [PATCH] Fix repository test. --- simgear/io/HTTPRepository.cxx | 3 ++- simgear/io/test_repository.cxx | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) 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);