Restrict the acceptable hash type to SHA256 only

This commit is contained in:
Frost Ming
2020-11-05 09:17:25 +08:00
parent 72f1a85faf
commit a94afd2afd
3 changed files with 5 additions and 4 deletions
+1
View File
@@ -0,0 +1 @@
Restrict the acceptable hash type to SHA256 only.
+2 -2
View File
@@ -81,8 +81,8 @@ class HashCache(SafeFileCache):
if can_hash:
# hash url WITH fragment
hash_value = self.get(new_location.url)
if not hash_value:
hash_value = "{}:{}".format(new_location.hash_name, new_location.hash)
if not hash_value and new_location.hash_name == FAVORITE_HASH:
hash_value = "{}:{}".format(FAVORITE_HASH, 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
@@ -285,8 +285,8 @@ index ef5ba4e..8f74271 100644
+ if can_hash:
+ # hash url WITH fragment
+ hash_value = self.get(new_location.url)
+ if not hash_value:
+ hash_value = "{}:{}".format(new_location.hash_name, new_location.hash)
+ if not hash_value and new_location.hash_name == FAVORITE_HASH:
+ hash_value = "{}:{}".format(FAVORITE_HASH, 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