From f12e21c572e37e8f311619da39994576430875ef Mon Sep 17 00:00:00 2001 From: Nicola Zilio Date: Wed, 8 Jan 2020 13:58:17 +0100 Subject: [PATCH] Change send_file to open, rather than download, PDF files --- src/wiki/core/http.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/wiki/core/http.py b/src/wiki/core/http.py index 2357a3e2..589478f1 100644 --- a/src/wiki/core/http.py +++ b/src/wiki/core/http.py @@ -44,6 +44,9 @@ def send_file(request, filepath, last_modified=None, filename=None): if filename: filename_escaped = filepath_to_uri(filename) - response["Content-Disposition"] = "attachment; filename=%s" % filename_escaped + if 'pdf' in mimetype.lower(): + response["Content-Disposition"] = "inline; filename=%s" % filename_escaped + else: + response["Content-Disposition"] = "attachment; filename=%s" % filename_escaped return response -- 2.45.2