Show More
@@ -303,7 +303,21 b' class FilesController(BaseRepoController' | |||||
303 | response.content_disposition = 'attachment; filename=%s-%s%s' \ |
|
303 | response.content_disposition = 'attachment; filename=%s-%s%s' \ | |
304 | % (repo_name, revision, ext) |
|
304 | % (repo_name, revision, ext) | |
305 |
|
305 | |||
306 | return cs.get_chunked_archive(stream=None, kind=fileformat) |
|
306 | import tempfile | |
|
307 | archive = tempfile.mkstemp()[1] | |||
|
308 | t = open(archive, 'wb') | |||
|
309 | cs.fill_archive(stream=t, kind=fileformat) | |||
|
310 | ||||
|
311 | def get_chunked_archive(archive): | |||
|
312 | stream = open(archive, 'rb') | |||
|
313 | while True: | |||
|
314 | data = stream.read(4096) | |||
|
315 | if not data: | |||
|
316 | os.remove(archive) | |||
|
317 | break | |||
|
318 | yield data | |||
|
319 | ||||
|
320 | return get_chunked_archive(archive) | |||
307 |
|
321 | |||
308 | @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', |
|
322 | @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', | |
309 | 'repository.admin') |
|
323 | 'repository.admin') |
General Comments 0
You need to be logged in to leave comments.
Login now