Изменил url аватарки

This commit is contained in:
urec56 2024-02-11 21:26:45 +03:00
parent cae2599414
commit d06e153a51

View file

@ -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}