views: open help image files as bytes (#55102)
This commit is contained in:
parent
5925bb7af4
commit
0ebab963bb
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue