DjangoBB

Django based forum engine

  • You are not logged in.
  • Root
  • » Bugs
  • » Uploading files corrupted on windows bug and suggested fix [RSS Feed]

#1 Feb. 18, 2010 01:42:12

kiwi_NZ
Registered: 2010-02-18
Posts: 5
Reputation: +  0  -
Profile   Send e-mail  

Uploading files corrupted on windows bug and suggested fix

Hi all,

Okay, I think I have found the source of this problem.

In djangobb_forum/forms.py about line 112 there is the line

file(path, 'w').write(memfile.read())
which I changed to
file(path, 'wb').write(memfile.read())

and then also in djangobb_forum/views.py about line 789

file_data = file(attachment.get_absolute_path()).read()

I changed to
file_data = file(attachment.get_absolute_path(), 'rb').read()

These file modes is what was corrupting the attachment upload and download on windows. Changing the files to be accessed in binary mode in windows seems to have fixed the problem.

Regards
Kiwi_NZ



Offline

#2 Feb. 18, 2010 11:03:24

slav0nic
DjangoBB Developer
From: Ukraine
Registered: 2009-10-25
Posts: 281
Reputation: +  6  -
Profile   Send e-mail  

Uploading files corrupted on windows bug and suggested fix

Ooops, Tnx)
commited

Offline

  • Root
  • » Bugs
  • » Uploading files corrupted on windows bug and suggested fix [RSS Feed]

Board footer

Moderator control

Powered by DjangoBB

Lo-Fi Version