From 465dd080438e479b215d225ffe9573d8e5e2230d Mon Sep 17 00:00:00 2001 From: Tran Trong Nghia <80335335+emladevops@users.noreply.github.com> Date: Tue, 20 Dec 2022 21:14:19 +0700 Subject: [PATCH] Update problem.py Fixed, if you follow the docs of DMOJ to setup nginx and supervisor, Pdf view won't work --- judge/views/problem.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/judge/views/problem.py b/judge/views/problem.py index 4810869..e5e2479 100644 --- a/judge/views/problem.py +++ b/judge/views/problem.py @@ -431,11 +431,11 @@ class ProblemPdfDescriptionView(ProblemMixin, SingleObjectMixin, View): if not problem.pdf_description: raise Http404() response = HttpResponse() - if request.META.get("SERVER_SOFTWARE", "").startswith("nginx/"): - response["X-Accel-Redirect"] = problem.pdf_description.path - else: - with open(problem.pdf_description.path, "rb") as f: - response.content = f.read() + #if request.META.get("SERVER_SOFTWARE", "").startswith("nginx/"): + # response["X-Accel-Redirect"] = problem.pdf_description.path + #else: + with open(problem.pdf_description.path, "rb") as f: + response.content = f.read() response["Content-Type"] = "application/pdf" response["Content-Disposition"] = "inline; filename=%s.pdf" % (problem.code,)