fix HashBlacklistContent.copy
authorHelmut Grohne <helmut@subdivi.de>
Wed, 13 Sep 2017 07:04:24 +0000 (09:04 +0200)
committerHelmut Grohne <helmut@subdivi.de>
Wed, 13 Sep 2017 07:04:24 +0000 (09:04 +0200)
It wasn't copying the stored member and thus could be blacklist "wrong"
content after a copy.

dedup/hashing.py

index 2a83929..c91fb64 100644 (file)
@@ -80,8 +80,10 @@ class HashBlacklistContent(object):
         return self.hashobj.hexdigest()
 
     def copy(self):
-        return HashBlacklistContent(self.hashobj.copy(), self.blacklist,
-                                    self.maxlen)
+        new = HashBlacklistContent(self.hashobj.copy(), self.blacklist,
+                                   self.maxlen)
+        new.stored = self.stored
+        return new
 
 class DecompressedHash(object):
     """Apply a decompression function before the hash. This class provides the