From 7e604c2feb9b1c0e4afc9f45e199d05e5c6b3918 Mon Sep 17 00:00:00 2001 From: Kavalar Date: Mon, 30 Oct 2023 01:27:13 +0300 Subject: [PATCH] fix write --- server.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server.py b/server.py index 8657d2c..038f52d 100644 --- a/server.py +++ b/server.py @@ -78,12 +78,12 @@ async def create_upload_file(file: UploadFile | None, package: Annotated[str, Fo os.makedirs(dir_last) if not os.path.exists(dir_stable): os.makedirs(dir_stable) - with open(f"{dir_file}/{filename}", 'a') as f: + with open(f"{dir_file}/{filename}", 'wb+') as f: f.write(contents) - with open(f"{dir_last}/{filename}", 'a') as f: + with open(f"{dir_last}/{filename}", 'wb+') as f: f.write(contents) if stable: - with open(f"{dir_stable}/{filename}", 'a') as f: + with open(f"{dir_stable}/{filename}", 'wb+') as f: f.write(contents) except Exception as err: return {"message": "There was an error uploading the file, error {err}".format(err=err)}