Merge pull request #283 from myleosu/myleosu-patch-1

fix FPSProblemImport bug
This commit is contained in:
LiYang
2020-07-08 09:40:17 +08:00
committed by GitHub

View File

@@ -676,6 +676,10 @@ class FPSProblemImport(CSRFExemptAPIView):
with tempfile.NamedTemporaryFile("wb") as tf: with tempfile.NamedTemporaryFile("wb") as tf:
for chunk in file.chunks(4096): for chunk in file.chunks(4096):
tf.file.write(chunk) tf.file.write(chunk)
tf.file.flush()
os.fsync(tf.file)
problems = FPSParser(tf.name).parse() problems = FPSParser(tf.name).parse()
else: else:
return self.error("Parse upload file error") return self.error("Parse upload file error")