Попытка фикса .doc файла
All checks were successful
Build And Push / publish (push) Successful in 2m40s

This commit is contained in:
2026-04-16 18:28:53 +03:00
parent eed99d99ea
commit d9d88302f3
2 changed files with 6 additions and 3 deletions

View File

@ -1,6 +1,6 @@
[project]
name = "HospitalAssistantBackend"
version = "1.5.10"
version = "1.5.11"
description = "Backend for Hospital Assistant"
readme = "README.md"
requires-python = ">=3.13,<3.14"

View File

@ -24,12 +24,15 @@ async def download_file(token: str):
raise e.NotFoundException
data = loads(file_data)
file_bytes = b64decode(data['data'])
file_name = data['filename']
file_bytes = b64decode(data['data'].strip(), validate=True)
print(f'Header: {file_bytes[:8].hex(" ")}')
return Response(
content=file_bytes,
media_type=data['content_type'],
headers={
'Content-Disposition': f'attachment; filename="{data["filename"]}"'
'Content-Disposition': f'attachment; filename="{file_name}"',
'Content-Length': str(len(file_bytes)),
},
)