From: James Turner Date: Thu, 26 May 2016 22:36:03 +0000 (+0100) Subject: HTTP: Always use absolute paths for hashes X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=eee93f7838c76edcdbea66c5d0e4c0c3b1d49391;p=simgear.git HTTP: Always use absolute paths for hashes Ensure we only compute / retrieve hashes for absolute paths. Fixes duplicate paths in repository hash cache. --- 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; }