Merge pull request #37 from emladevops/master

Fix problem pdf view
This commit is contained in:
Phuoc Dinh Le 2022-12-20 15:27:30 -06:00 committed by GitHub
commit 52dea1a3bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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