Show More
@@ -521,10 +521,10 b' class TestRepositoryArchival(object):' | |||
|
521 | 521 | def test_archival(self, backend): |
|
522 | 522 | backend.enable_downloads() |
|
523 | 523 | commit = backend.repo.get_commit(commit_idx=173) |
|
524 |
for a |
|
|
525 | mime_type, arch_ext = info | |
|
526 |
short = commit.short_id + |
|
|
527 |
fname = commit.raw_id + |
|
|
524 | for a_type, content_type, extension in settings.ARCHIVE_SPECS: | |
|
525 | ||
|
526 | short = commit.short_id + extension | |
|
527 | fname = commit.raw_id + extension | |
|
528 | 528 | filename = '%s-%s' % (backend.repo_name, short) |
|
529 | 529 | response = self.app.get( |
|
530 | 530 | route_path('repo_archivefile', |
@@ -534,7 +534,7 b' class TestRepositoryArchival(object):' | |||
|
534 | 534 | assert response.status == '200 OK' |
|
535 | 535 | headers = [ |
|
536 | 536 | ('Content-Disposition', 'attachment; filename=%s' % filename), |
|
537 |
('Content-Type', '%s' % |
|
|
537 | ('Content-Type', '%s' % content_type), | |
|
538 | 538 | ] |
|
539 | 539 | |
|
540 | 540 | for header in headers: |
@@ -260,8 +260,7 b' class RepoFilesView(RepoAppView):' | |||
|
260 | 260 | fileformat = None |
|
261 | 261 | ext = None |
|
262 | 262 | content_type = None |
|
263 |
for a_type, |
|
|
264 | content_type, extension = ext_data | |
|
263 | for a_type, content_type, extension in settings.ARCHIVE_SPECS: | |
|
265 | 264 | |
|
266 | 265 | if fname.endswith(extension): |
|
267 | 266 | fileformat = a_type |
@@ -1111,7 +1111,7 b' class BaseCommit(object):' | |||
|
1111 | 1111 | |
|
1112 | 1112 | :raise VCSError: If prefix has a problem. |
|
1113 | 1113 | """ |
|
1114 |
allowed_kinds = settings.ARCHIVE_SPECS |
|
|
1114 | allowed_kinds = [x[0] for x in settings.ARCHIVE_SPECS] | |
|
1115 | 1115 | if kind not in allowed_kinds: |
|
1116 | 1116 | raise ImproperArchiveTypeError( |
|
1117 | 1117 | 'Archive kind (%s) not supported use one of %s' % |
@@ -42,12 +42,16 b' BACKENDS = {' | |||
|
42 | 42 | 'svn': 'rhodecode.lib.vcs.backends.svn.SubversionRepository', |
|
43 | 43 | } |
|
44 | 44 | |
|
45 | # TODO: Remove once controllers/files.py is adjusted | |
|
46 |
ARCHIVE_SPECS = |
|
|
47 |
'tbz2' |
|
|
48 |
|
|
|
49 | 'zip': ('application/zip', '.zip'), | |
|
50 | } | |
|
45 | ||
|
46 | ARCHIVE_SPECS = [ | |
|
47 | ('tbz2', 'application/x-bzip2', 'tbz2'), | |
|
48 | ('tbz2', 'application/x-bzip2', '.tar.bz2'), | |
|
49 | ||
|
50 | ('tgz', 'application/x-gzip', '.tgz'), | |
|
51 | ('tgz', 'application/x-gzip', '.tar.gz'), | |
|
52 | ||
|
53 | ('zip', 'application/zip', '.zip'), | |
|
54 | ] | |
|
51 | 55 | |
|
52 | 56 | HOOKS_PROTOCOL = None |
|
53 | 57 | HOOKS_DIRECT_CALLS = False |
General Comments 0
You need to be logged in to leave comments.
Login now