forked from TrueCloudLab/s3-tests
fix random file verifier with small files
The file verifier will now correctly verify small files (smaller than the md5 digest size), as long as the data that is there matches what the digest would be.
This commit is contained in:
parent
91a39caf46
commit
91c4f88860
1 changed files with 3 additions and 0 deletions
|
@ -78,6 +78,9 @@ class FileVerifier(object):
|
|||
Returns True if this file looks valid. The file is valid if the end
|
||||
of the file has the md5 digest for the first part of the file.
|
||||
"""
|
||||
if self.size < self.hash.digest_size:
|
||||
return self.hash.digest().startswith(self.buf)
|
||||
|
||||
return self.buf == self.hash.digest()
|
||||
|
||||
def files(mean, stddev, seed=None):
|
||||
|
|
Loading…
Reference in a new issue