|
|
|
@ -49,7 +49,7 @@ def hash_archive(cnt, dest=None, imposed_hash=None):
|
|
|
|
|
sha = hashlib.sha1(data.encode() if isinstance(data, str) else data).hexdigest() |
|
|
|
|
yield MailTest("Your tarball SHA-1 is %s." % sha, -1) |
|
|
|
|
if dest is not None and os.path.exists(os.path.join(dest, login + "." + sha)): |
|
|
|
|
yield MailTest("You have already uploaded this tarball.", 1) |
|
|
|
|
yield MailTest("You already have uploaded this tarball.", 1) |
|
|
|
|
yield False |
|
|
|
|
elif imposed_hash is not None and imposed_hash != sha: |
|
|
|
|
yield MailTest("This is not the expected hash. Your tarball's hash must be: %s." % imposed_hash, 1) |
|
|
|
@ -92,7 +92,7 @@ def extract(cnt, dest=None):
|
|
|
|
|
ldest = os.path.join(dest, login) |
|
|
|
|
dest = os.path.join(dest, login + "." + sha) |
|
|
|
|
if os.path.exists(dest): |
|
|
|
|
yield MailTest("You have already uploaded this tarball.", 1) |
|
|
|
|
yield MailTest("You already have uploaded this tarball.", 1) |
|
|
|
|
return |
|
|
|
|
last_dest = os.readlink(ldest) if os.path.exists(ldest) else None |
|
|
|
|
|
|
|
|
|