Skip to content

Commit 055d73a

Browse files
committed
fix: changed Content-Disposition from attachement to inline display in browser
1 parent 63c82a8 commit 055d73a

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

docker_image/src/app_api_handler.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@ async def get_document(filename: str):
8080
file_path = (DATA_SOURCE_DIR / filename).resolve()
8181
if not file_path.is_relative_to(DATA_SOURCE_DIR) or not file_path.is_file():
8282
raise HTTPException(status_code=404, detail="Document not found")
83-
return FileResponse(file_path, media_type="application/pdf", filename=filename)
83+
return FileResponse(
84+
file_path,
85+
media_type="application/pdf",
86+
headers={"Content-Disposition": f'inline; filename="{filename}"'},
87+
)
8488

8589

8690
if __name__ == "__main__":

frontend/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules/
22
dist/
33
.env
4+
.vercel

0 commit comments

Comments
 (0)