Skip to content

Commit

Permalink
(no-ticket) Fix some things not working with remote filetracker
Browse files Browse the repository at this point in the history
Committer's note:

I'm pretty sure the Tadeusz is the author of those changes,
so I set him as author, but I found the changes uncommitted,
so I'm not 100% sure it's his.

 -- Wojciech Dubiel

Change-Id: I70a51c2e1212cda3e206c0d86f578bdb6c379b86
  • Loading branch information
teqwve authored and Paweł Dietrich committed Aug 9, 2023
1 parent 4c6a4c4 commit f22715b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
8 changes: 4 additions & 4 deletions oioioi/confirmations/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ def submission_receipt_proof(submission):
).count()
+ 1
)
source_hash = hashlib.sha256()
for chunk in submission.source_file.chunks():
source_hash.update(chunk)
submission.source_file.seek(0)
with submission.source_file.read_using_cache() as source_file:
source_hash = hashlib.sha256()
for chunk in source_file.chunks():
source_hash.update(chunk)

proof_data = {
'id': submission.id,
Expand Down
3 changes: 1 addition & 2 deletions oioioi/mailsubmit/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,9 @@ def accept_mail_submission(request, mailsubmission):

def mail_submission_hashes(mailsubmission):
source_hash = hashlib.sha256()
for chunk in mailsubmission.source_file.chunks():
for chunk in mailsubmission.source_file.read_using_cache().chunks():
source_hash.update(chunk)
source_hash = source_hash.hexdigest()
mailsubmission.source_file.seek(0)

pi = mailsubmission.problem_instance

Expand Down

0 comments on commit f22715b

Please sign in to comment.