diff --git a/problem/views/admin.py b/problem/views/admin.py index af66dc3d..1b0abf36 100644 --- a/problem/views/admin.py +++ b/problem/views/admin.py @@ -1,7 +1,6 @@ import hashlib import json import os -import shutil import tempfile import zipfile from wsgiref.util import FileWrapper @@ -676,10 +675,10 @@ class FPSProblemImport(CSRFExemptAPIView): with tempfile.NamedTemporaryFile("wb") as tf: for chunk in file.chunks(4096): tf.file.write(chunk) - + tf.file.flush() os.fsync(tf.file) - + problems = FPSParser(tf.name).parse() else: return self.error("Parse upload file error") diff --git a/utils/constants.py b/utils/constants.py index ac0c97b6..749b20da 100644 --- a/utils/constants.py +++ b/utils/constants.py @@ -33,4 +33,4 @@ class Difficulty(Choices): HIGH = "High" -CONTEST_PASSWORD_SESSION_KEY = "contest_password" \ No newline at end of file +CONTEST_PASSWORD_SESSION_KEY = "contest_password"