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:
|
if not problem.pdf_description:
|
||||||
raise Http404()
|
raise Http404()
|
||||||
response = HttpResponse()
|
response = HttpResponse()
|
||||||
if hasattr(settings, "DMOJ_PDF_PROBLEM_INTERNAL") and request.META.get(
|
if request.META.get("SERVER_SOFTWARE", "").startswith("nginx/"):
|
||||||
"SERVER_SOFTWARE", ""
|
response["X-Accel-Redirect"] = problem.pdf_description
|
||||||
).startswith("nginx/"):
|
|
||||||
response["X-Accel-Redirect"] = problem.pdf_description.path
|
|
||||||
else:
|
else:
|
||||||
with open(problem.pdf_description.path, "rb") as f:
|
with open(problem.pdf_description.path, "rb") as f:
|
||||||
response.content = f.read()
|
response.content = f.read()
|
||||||
|
|
Loading…
Reference in a new issue