diff --git a/rhodecode/controllers/files.py b/rhodecode/controllers/files.py --- a/rhodecode/controllers/files.py +++ b/rhodecode/controllers/files.py @@ -221,6 +221,10 @@ class FilesController(BaseRepoController c.cs = self.__get_cs_or_redirect(revision, repo_name) c.file = self.__get_filenode_or_redirect(repo_name, c.cs, f_path) + if c.file.is_binary: + return redirect(url('files_home', repo_name=c.repo_name, + revision=c.cs.raw_id, f_path=f_path)) + c.file_history = self._get_node_history(c.cs, f_path) c.f_path = f_path diff --git a/rhodecode/templates/files/files_annotate.html b/rhodecode/templates/files/files_annotate.html --- a/rhodecode/templates/files/files_annotate.html +++ b/rhodecode/templates/files/files_annotate.html @@ -44,9 +44,11 @@ h.url('files_raw_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path))} / ${h.link_to(_('download as raw'), h.url('files_rawfile_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path))} - % if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name): + % if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name): + % if not c.file.is_binary: / ${h.link_to(_('edit'), h.url('files_edit_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path))} + % endif % endif
${_('History')}
diff --git a/rhodecode/templates/files/files_source.html b/rhodecode/templates/files/files_source.html --- a/rhodecode/templates/files/files_source.html +++ b/rhodecode/templates/files/files_source.html @@ -16,8 +16,10 @@ / ${h.link_to(_('download as raw'), h.url('files_rawfile_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.f_path))} % if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name): + % if not c.files_list.is_binary: / ${h.link_to(_('edit'), h.url('files_edit_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.f_path))} + % endif % endif
${_('History')}