form: use binary files for uploads (#36515)

This commit is contained in:
Frédéric Péters 2019-11-13 14:28:15 +01:00
parent 56e9be1142
commit d4e9a16468
1 changed files with 2 additions and 2 deletions

View File

@ -815,7 +815,7 @@ class PicklableUpload(Upload):
return self.__dict__.get('fp')
elif hasattr(self, 'qfilename'):
basedir = os.path.join(get_publisher().app_dir, 'uploads')
self.fp = file(os.path.join(basedir, self.qfilename))
self.fp = open(os.path.join(basedir, self.qfilename), 'rb')
return self.fp
return None
@ -839,7 +839,7 @@ class PicklableUpload(Upload):
def get_content(self):
if hasattr(self, 'qfilename'):
filename = os.path.join(get_publisher().app_dir, 'uploads', self.qfilename)
return file(filename).read()
return open(filename, 'rb').read()
return None