Optimize pdf description

This commit is contained in:
cuom1999 2023-03-08 21:25:54 -06:00
parent 8b814640ea
commit f373ecbc84

View file

@ -450,9 +450,9 @@ 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:
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()