]> git.mxchange.org Git - simgear.git/commitdiff
HTTP: Always use absolute paths for hashes
authorJames Turner <zakalawe@mac.com>
Thu, 26 May 2016 22:36:03 +0000 (23:36 +0100)
committerRoland Haeder <roland@mxchange.org>
Sat, 13 Aug 2016 08:21:16 +0000 (10:21 +0200)
Ensure we only compute / retrieve hashes for absolute paths. Fixes
duplicate paths in repository hash cache.

simgear/io/HTTPRepository.cxx

index d87fe3f4c98adc817104f9f825cb3592408ff521..05635dac4c62ac15c5710d49aebd53c408fa4f4c 100644 (file)
@@ -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;
         }