This commit is contained in:
Kavalar 2023-10-31 00:53:04 +03:00
parent 584af01366
commit b51ee3db69

View File

@ -82,17 +82,17 @@ async def create_upload_file(file: UploadFile | None, package: Annotated[str, Fo
if os.path.exists(f"{dir_file}/{filename}"):
os.remove(f"{dir_file}/{filename}")
with open(f"{dir_file}/{filename}", 'a') as f:
f.write(str(contents))
with open(f"{dir_file}/{filename}", 'wb') as f:
f.write(contents)
if os.path.exists(f"{dir_last}/{filename}"):
os.remove(f"{dir_last}/{filename}")
with open(f"{dir_last}/{filename}", 'a') as f:
f.write(str(contents))
with open(f"{dir_last}/{filename}", 'wb') as f:
f.write(contents)
if stable:
if os.path.exists(f"{dir_stable}/{filename}"):
os.remove(f"{dir_stable}/{filename}")
with open(f"{dir_stable}/{filename}", 'a') as f:
f.write(str(contents))
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)}
finally: