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
commit d5ccadcdf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -676,6 +676,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")