Mercurial > kallithea
diff rhodecode/controllers/files.py @ 942:32318ec7bfc1 beta
added branch/tag options to download links in summary
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Thu, 13 Jan 2011 23:35:46 +0100 |
parents | 35e701dc801e |
children | 05b59c48556f |
line wrap: on
line diff
--- a/rhodecode/controllers/files.py Tue Jan 11 22:51:48 2011 +0100 +++ b/rhodecode/controllers/files.py Thu Jan 13 23:35:46 2011 +0100 @@ -149,15 +149,23 @@ return render('files/files_annotate.html') def archivefile(self, repo_name, fname): - info = fname.split('.') - revision, fileformat = info[0], '.' + '.'.join(info[1:]) archive_specs = { '.tar.bz2': ('application/x-tar', 'tbz2'), '.tar.gz': ('application/x-tar', 'tgz'), '.zip': ('application/zip', 'zip'), } + + fileformat = None + revision = None + + for ext in archive_specs.keys(): + archive_spec = fname.split(ext) + if len(archive_spec) == 2: + fileformat = archive_spec[1] or ext + revision = archive_spec[0] + if not archive_specs.has_key(fileformat): - return _('Unknown archive type %s') % fileformat + return _('Unknown archive type') repo = ScmModel().get_repo(repo_name)