Fix nginx for pdf
This commit is contained in:
parent
7f3e22e3bf
commit
66b9240fd4
1 changed files with 2 additions and 4 deletions
|
@ -408,10 +408,8 @@ class ProblemPdfDescriptionView(ProblemMixin, SingleObjectMixin, View):
|
|||
if not problem.pdf_description:
|
||||
raise Http404()
|
||||
response = HttpResponse()
|
||||
if hasattr(settings, "DMOJ_PDF_PROBLEM_INTERNAL") and request.META.get(
|
||||
"SERVER_SOFTWARE", ""
|
||||
).startswith("nginx/"):
|
||||
response["X-Accel-Redirect"] = problem.pdf_description.path
|
||||
if request.META.get("SERVER_SOFTWARE", "").startswith("nginx/"):
|
||||
response["X-Accel-Redirect"] = problem.pdf_description
|
||||
else:
|
||||
with open(problem.pdf_description.path, "rb") as f:
|
||||
response.content = f.read()
|
||||
|
|
Loading…
Reference in a new issue