Show More
@@ -22,7 +22,7 b'' | |||
|
22 | 22 | # |
|
23 | 23 | # You should have received a copy of the GNU General Public License |
|
24 | 24 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
25 | ||
|
25 | from __future__ import with_statement | |
|
26 | 26 | import os |
|
27 | 27 | import logging |
|
28 | 28 | import traceback |
@@ -360,13 +360,14 b' class FilesController(BaseRepoController' | |||
|
360 | 360 | except (ImproperArchiveTypeError, KeyError): |
|
361 | 361 | return _('Unknown archive type') |
|
362 | 362 | |
|
363 | archive = tempfile.NamedTemporaryFile(mode='w+r+b', delete=False) | |
|
364 | cs.fill_archive(stream=archive, kind=fileformat, subrepos=subrepos) | |
|
365 | archive.close() | |
|
363 | fd, _archive_name = tempfile.mkstemp(suffix='rcarchive') | |
|
364 | with open(_archive_name, 'wb') as f: | |
|
365 | cs.fill_archive(stream=f, kind=fileformat, subrepos=subrepos) | |
|
366 | ||
|
366 | 367 | response.content_type = content_type |
|
367 | 368 | response.content_disposition = 'attachment; filename=%s-%s%s' \ |
|
368 | 369 | % (repo_name, revision[:12], ext) |
|
369 |
response.content_length = str(os.path.getsize(archive |
|
|
370 | response.content_length = str(os.path.getsize(_archive_name)) | |
|
370 | 371 | |
|
371 | 372 | def get_chunked_archive(tmpfile): |
|
372 | 373 | while True: |
@@ -376,7 +377,7 b' class FilesController(BaseRepoController' | |||
|
376 | 377 | os.unlink(tmpfile.name) |
|
377 | 378 | break |
|
378 | 379 | yield data |
|
379 |
return get_chunked_archive(tmpfile=open(archive |
|
|
380 | return get_chunked_archive(tmpfile=open(_archive_name, 'rb')) | |
|
380 | 381 | |
|
381 | 382 | @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', |
|
382 | 383 | 'repository.admin') |
General Comments 0
You need to be logged in to leave comments.
Login now