views: open help image files as bytes (#55102)

This commit is contained in:
Frédéric Péters 2021-06-22 19:20:24 +02:00 committed by Emmanuel Cazenave
parent 5925bb7af4
commit 0ebab963bb
1 changed files with 1 additions and 1 deletions

View File

@ -449,7 +449,7 @@ def help(request, pagename='index.html'):
filepath = os.path.join(settings.HELP_DIR, pagename)
if not os.path.abspath(filepath).startswith(settings.HELP_DIR):
return HttpResponseForbidden()
response = HttpResponse(content=open(filepath))
response = HttpResponse(content=open(filepath, 'rb'))
response['Content-Type'] = 'image/png'
return response