From 43df53adaf43311078e62fd7eb20b218a021cc59 Mon Sep 17 00:00:00 2001 From: myleosu <33693783+myleosu@users.noreply.github.com> Date: Sat, 16 Nov 2019 20:59:21 +0800 Subject: [PATCH] Update admin.py FPSProblemImport bug --- problem/views/admin.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/problem/views/admin.py b/problem/views/admin.py index ee04dc1..5b36859 100644 --- a/problem/views/admin.py +++ b/problem/views/admin.py @@ -676,6 +676,8 @@ class FPSProblemImport(CSRFExemptAPIView): with tempfile.NamedTemporaryFile("wb") as tf: for chunk in file.chunks(4096): tf.file.write(chunk) + tf.file.flush() #确保file写入tf成功 + os.fsync(tf.file) #确保file写入tf成功 problems = FPSParser(tf.name).parse() else: return self.error("Parse upload file error")