From eee93f7838c76edcdbea66c5d0e4c0c3b1d49391 Mon Sep 17 00:00:00 2001 From: James Turner Date: Thu, 26 May 2016 23:36:03 +0100 Subject: [PATCH] HTTP: Always use absolute paths for hashes Ensure we only compute / retrieve hashes for absolute paths. Fixes duplicate paths in repository hash cache. --- simgear/io/HTTPRepository.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/simgear/io/HTTPRepository.cxx b/simgear/io/HTTPRepository.cxx index d87fe3f4..05635dac 100644 --- a/simgear/io/HTTPRepository.cxx +++ b/simgear/io/HTTPRepository.cxx @@ -233,7 +233,7 @@ public: void dirIndexUpdated(const std::string& hash) { - SGPath fpath(_relativePath); + SGPath fpath(absolutePath()); fpath.append(".dirindex"); _repository->updatedFileContents(fpath, hash); @@ -476,7 +476,7 @@ public: if (it == children.end()) { SG_LOG(SG_TERRASYNC, SG_WARN, "updated file but not found in dir:" << _relativePath << " " << file); } else { - SGPath fpath(_relativePath); + SGPath fpath(absolutePath()); fpath.append(file); if (it->hash != hash) { @@ -588,7 +588,7 @@ private: ok = _repository->deleteDirectory(fpath.str()); } else { // remove the hash cache entry - _repository->updatedFileContents(fpath, std::string()); + _repository->updatedFileContents(p, std::string()); ok = p.remove(); } @@ -1146,7 +1146,7 @@ HTTPRepository::failure() const delete d; // update the hash cache too - updatedFileContents(path, std::string()); + updatedFileContents(d->absolutePath(), std::string()); return result; } -- 2.39.5