fix the hash value

This commit is contained in:
Frost Ming
2020-10-27 18:29:51 +08:00
parent 1249e20a95
commit 491fa333b1
2 changed files with 8 additions and 2 deletions
+4 -1
View File
@@ -80,7 +80,10 @@ class HashCache(SafeFileCache):
can_hash = new_location.hash
if can_hash:
# hash url WITH fragment
hash_value = self.get(new_location.url) or new_location.hash.encode('utf8')
hash_value = self.get(new_location.url)
if not hash_value:
hash_value = "{}:{}".format(new_location.hash_name, new_location.hash)
hash_value = hash_value.encode('utf8')
if not hash_value:
hash_value = self._get_file_hash(new_location) if not new_location.url.startswith("ssh") else None
hash_value = hash_value.encode('utf8') if hash_value else None
@@ -282,7 +282,10 @@ index ef5ba4e..b96acf6 100644
+ can_hash = new_location.hash
+ if can_hash:
+ # hash url WITH fragment
+ hash_value = self.get(new_location.url) or new_location.hash.encode('utf8')
+ hash_value = self.get(new_location.url)
+ if not hash_value:
+ hash_value = "{}:{}".format(new_location.hash_name, new_location.hash)
+ hash_value = hash_value.encode('utf8')
+ if not hash_value:
+ hash_value = self._get_file_hash(new_location) if not new_location.url.startswith("ssh") else None
+ hash_value = hash_value.encode('utf8') if hash_value else None