Opened 15 years ago

Closed 15 years ago

#1122 closed defect (invalid)

Django do not serve static binary files (e.g. images) correctly

Reported by: hipertracker@… Owned by: Adrian Holovaty
Component: Core (Other) Version: 0.90
Severity: critical Keywords: static files images
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Django do not serve static binary files (e.g. images) correctly


django-0.90-py2.4.egg\django\views\ line 52:

Change line 52 from:

return HttpResponse(open(fullpath, 'rb').read(), mimetype=mimetype)


return HttpResponse(open(fullpath).read(), mimetype=mimetype)

Change History (4)

comment:1 Changed 15 years ago by eugene@…

Could you explain what's wrong with the currrent code (1 line)? What kind of effects do you see? What OS and Python version did you use? How do you solve the problem by removing 'rb'? I cannot reproduce the problem.

comment:2 Changed 15 years ago by rjwittams

It sounds like they have uploaded an image in ASCII mode to their server, so this would end up undoing the damage. User error and should be closed if so....

comment:3 Changed 15 years ago by hipertracker@…

django v0.9 has line return HttpResponse(open(fullpath).read(), mimetype=mimetype). I found in svn it was corrected. I made a mistake with message, It had to be:
Change line 52 from:
HttpResponse(open(fullpath).read(), mimetype=mimetype)
return HttpResponse(open(fullpath, 'rb').read(), mimetype=mimetype)

comment:4 Changed 15 years ago by Jacob

Resolution: invalid
Status: newclosed

This is fixed in trunk.

Note: See TracTickets for help on using tickets.
Back to Top