Compare commits

...

8 Commits

Author SHA1 Message Date
b51ee3db69 fix mod 2023-10-31 00:53:04 +03:00
584af01366 fix 2023-10-30 02:35:18 +03:00
7be0209169 fix save file 2023-10-30 02:29:47 +03:00
7e8afb21ec fix save file 2023-10-30 02:15:27 +03:00
104401dab9 file mod 2023-10-30 02:02:47 +03:00
7e604c2feb fix write 2023-10-30 01:27:13 +03:00
cefd4fb745 fix 2023-10-30 01:20:03 +03:00
5b8ab1ab23 some 2023-10-30 01:19:05 +03:00
2 changed files with 18 additions and 34 deletions

View File

@ -1,35 +1,11 @@
anyio==3.6.2
bcrypt==4.0.1
certifi==2022.12.7
charset-normalizer==3.1.0
click==8.1.3
crypto==1.4.1
fastapi==0.95.0
greenlet==2.0.2
anyio==4.0.0
certifi==2023.7.22
emoji==2.8.0
exceptiongroup==1.1.3
h11==0.14.0
httptools==0.5.0
httpcore==0.18.0
httpx==0.25.0
idna==3.4
install==1.3.5
mysql-connector-python==8.0.32
mysql-connector-python-rf==2.2.2
Naked==0.1.32
passlib==1.7.4
protobuf==3.20.3
pydantic==1.10.6
python-dotenv==1.0.0
python-magic==0.4.27
python-multipart==0.0.6
PyYAML==6.0
requests==2.28.2
shellescape==3.8.1
python-telegram-bot==20.6
sniffio==1.3.0
SQLAlchemy==1.4.41
sqlalchemy2-stubs==0.0.2a32
sqlmodel==0.0.8
starlette==0.26.1
typing_extensions==4.5.0
urllib3==1.26.15
uvicorn==0.21.1
uvloop==0.17.0
watchfiles==0.18.1
websockets==10.4

View File

@ -1,3 +1,4 @@
import pathlib
from typing import Union, Annotated
import uvicorn
from routes.user_routes import user_route
@ -78,12 +79,19 @@ 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:
if os.path.exists(f"{dir_file}/{filename}"):
os.remove(f"{dir_file}/{filename}")
with open(f"{dir_file}/{filename}", 'wb') as f:
f.write(contents)
with open(f"{dir_last}/{filename}", 'a') as f:
if os.path.exists(f"{dir_last}/{filename}"):
os.remove(f"{dir_last}/{filename}")
with open(f"{dir_last}/{filename}", 'wb') as f:
f.write(contents)
if stable:
with open(f"{dir_stable}/{filename}", 'a') as f:
if os.path.exists(f"{dir_stable}/{filename}"):
os.remove(f"{dir_stable}/{filename}")
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)}