Revert prev commit

This commit is contained in:
cuom1999 2023-03-08 21:31:41 -06:00
parent 28923f755b
commit bdae79eeda

View file

@ -450,13 +450,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"] = os.path.join(
settings.DMOJ_PROBLEM_DATA_ROOT, 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,)