fix mod
This commit is contained in:
parent
584af01366
commit
b51ee3db69
12
server.py
12
server.py
@ -82,17 +82,17 @@ async def create_upload_file(file: UploadFile | None, package: Annotated[str, Fo
|
|||||||
|
|
||||||
if os.path.exists(f"{dir_file}/{filename}"):
|
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}", 'wb') as f:
|
||||||
f.write(str(contents))
|
f.write(contents)
|
||||||
if os.path.exists(f"{dir_last}/{filename}"):
|
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}", 'wb') as f:
|
||||||
f.write(str(contents))
|
f.write(contents)
|
||||||
if stable:
|
if stable:
|
||||||
if os.path.exists(f"{dir_stable}/{filename}"):
|
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}", 'wb') as f:
|
||||||
f.write(str(contents))
|
f.write(contents)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
return {"message": "There was an error uploading the file, error {err}".format(err=err)}
|
return {"message": "There was an error uploading the file, error {err}".format(err=err)}
|
||||||
finally:
|
finally:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user