diff --git a/pyproject.toml b/pyproject.toml index 52a3ccb..96a20cb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" diff --git a/src/apps/download/v1/router.py b/src/apps/download/v1/router.py index 99bc037..c8787ec 100644 --- a/src/apps/download/v1/router.py +++ b/src/apps/download/v1/router.py @@ -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)), }, )