Mercurial > kallithea
comparison rhodecode/controllers/files.py @ 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 | 008e460c5b9d |
children | 0e1023147334 |
comparison
equal
deleted
inserted
replaced
4071:35fcc232f652 | 4072:bf5c2c75c976 |
---|---|
361 | 361 |
362 if file_obj is not None and hasattr(file_obj, 'filename'): | 362 if file_obj is not None and hasattr(file_obj, 'filename'): |
363 filename = file_obj.filename | 363 filename = file_obj.filename |
364 content = file_obj.file | 364 content = file_obj.file |
365 | 365 |
366 if hasattr(content, 'file'): | |
367 # non posix systems store real file under file attr | |
368 content = content.file | |
369 | |
366 if not content: | 370 if not content: |
367 h.flash(_('No content'), category='warning') | 371 h.flash(_('No content'), category='warning') |
368 return redirect(url('changeset_home', repo_name=c.repo_name, | 372 return redirect(url('changeset_home', repo_name=c.repo_name, |
369 revision='tip')) | 373 revision='tip')) |
370 if not filename: | 374 if not filename: |