From d06e153a51889eda614e569c9da8cc643185b71d Mon Sep 17 00:00:00 2001 From: urec56 Date: Sun, 11 Feb 2024 21:26:45 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B8=D0=BB=20ur?= =?UTF-8?q?l=20=D0=B0=D0=B2=D0=B0=D1=82=D0=B0=D1=80=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/main.py b/app/main.py index 0c69c26..b6c585d 100644 --- a/app/main.py +++ b/app/main.py @@ -40,9 +40,10 @@ app.mount("/static", StaticFiles(directory="app/static"), name="static") @app.post('/images', response_model=dict[str, str]) async def upload_images(file: UploadFile): name = generate_random_string() - with open(f'app/static/images/{name}.webp', 'wb+') as file_object: + image_url = f'app/static/images/{name}_avatar.png' + with open(image_url, 'wb+') as file_object: shutil.copyfileobj(file.file, file_object) - return {'name': name} + return {'image_url': image_url}