This commit is contained in:
Kavalar 2023-10-30 02:35:18 +03:00
parent 7be0209169
commit 584af01366

View File

@ -79,13 +79,17 @@ async def create_upload_file(file: UploadFile | None, package: Annotated[str, Fo
os.makedirs(dir_last) os.makedirs(dir_last)
if not os.path.exists(dir_stable): if not os.path.exists(dir_stable):
os.makedirs(dir_stable) os.makedirs(dir_stable)
if os.path.exists(f"{dir_file}/{filename}"):
os.remove(f"{dir_file}/{filename}") os.remove(f"{dir_file}/{filename}")
with open(f"{dir_file}/{filename}", 'a') as f: with open(f"{dir_file}/{filename}", 'a') as f:
f.write(str(contents)) f.write(str(contents))
if os.path.exists(f"{dir_last}/{filename}"):
os.remove(f"{dir_last}/{filename}") os.remove(f"{dir_last}/{filename}")
with open(f"{dir_last}/{filename}", 'a') as f: with open(f"{dir_last}/{filename}", 'a') as f:
f.write(str(contents)) f.write(str(contents))
if stable: if stable:
if os.path.exists(f"{dir_stable}/{filename}"):
os.remove(f"{dir_stable}/{filename}") os.remove(f"{dir_stable}/{filename}")
with open(f"{dir_stable}/{filename}", 'a') as f: with open(f"{dir_stable}/{filename}", 'a') as f:
f.write(str(contents)) f.write(str(contents))