Uploaded binary files are corrupted on Windows
|Reported by:||Steadicat||Owned by:||adrian|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
On Windows, binary files have to be written to disk with the 'b' flag, otherwise all line-endings are converted to CRLF.
Line 979 in source:django/trunk/django/core/meta.py#293 should be changed to:
fp = open(getattr(self, 'get_%s_filename' % field.name)(), 'wb')
Currently all uploaded files are written to disk as text files. Binary files get corrupted as any CR or LF byte is replaced with a CRLF.