fix save file
This commit is contained in:
parent
104401dab9
commit
7e8afb21ec
15
server.py
15
server.py
@ -78,16 +78,13 @@ 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)
|
||||||
with open(f"{dir_file}/{filename}", 'r + b') as f:
|
with open(f"{dir_file}/{filename}", 'w') as f:
|
||||||
f.seek(0)
|
f.write(str(contents))
|
||||||
f.write(contents)
|
with open(f"{dir_last}/{filename}", 'w') as f:
|
||||||
with open(f"{dir_last}/{filename}", 'r + b') as f:
|
f.write(str(contents))
|
||||||
f.seek(0)
|
|
||||||
f.write(contents)
|
|
||||||
if stable:
|
if stable:
|
||||||
with open(f"{dir_stable}/{filename}", 'r + b') as f:
|
with open(f"{dir_stable}/{filename}", 'w') as f:
|
||||||
f.seek(0)
|
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…
Reference in New Issue
Block a user