changeset 4072:bf5c2c75c976

fixes issue #856 file upload >1000 bytes on windows throws exception. The returned object is a true file object on POSIX platforms. On other platforms, it is a file-like object whose `file` attribute is the underlying true file object. We check if such object has a file attribute which is missing on POSIX platform
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 01 Jul 2013 11:20:59 +0200
parents 35fcc232f652
children 2c82dd8ba318
files rhodecode/controllers/files.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/controllers/files.py	Sun Jun 30 23:41:56 2013 +0200
+++ b/rhodecode/controllers/files.py	Mon Jul 01 11:20:59 2013 +0200
@@ -363,6 +363,10 @@
                 filename = file_obj.filename
                 content = file_obj.file
 
+                if hasattr(content, 'file'):
+                    # non posix systems store real file under file attr
+                    content = content.file
+
             if not content:
                 h.flash(_('No content'), category='warning')
                 return redirect(url('changeset_home', repo_name=c.repo_name,