diff --git a/rhodecode/controllers/files.py b/rhodecode/controllers/files.py
--- a/rhodecode/controllers/files.py
+++ b/rhodecode/controllers/files.py
@@ -224,12 +224,16 @@ class FilesController(BaseController):
elif c.action == 'diff':
if node1.size > self.cut_off_limit or node2.size > self.cut_off_limit:
c.cur_diff = _('Diff is to big to display')
+ elif node1.is_binary or node2.is_binary:
+ c.cur_diff = _('Binary file')
else:
c.cur_diff = diff.as_html()
else:
#default option
if node1.size > self.cut_off_limit or node2.size > self.cut_off_limit:
c.cur_diff = _('Diff is to big to display')
+ elif node1.is_binary or node2.is_binary:
+ c.cur_diff = _('Binary file')
else:
c.cur_diff = diff.as_html()
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
@@ -63,24 +63,28 @@
"${c.file.message}"
+ %if c.file.is_binary:
+ ${_('Binary file')}
+ %else:
% if c.file.size < c.cut_off_limit:
${h.pygmentize_annotation(c.file,linenos=True,anchorlinenos=True,lineanchors='S',cssclass="code-highlight")}
%else:
${_('File is to big to display')} ${h.link_to(_('show as raw'),
h.url('files_raw_home',repo_name=c.repo_name,revision=c.cs.revision,f_path=c.f_path))}
- %endif
+ %endif
+
+ %endif
-
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
@@ -36,6 +36,9 @@
"${c.files_list.last_changeset.message}"
+ %if c.files_list.is_binary:
+ ${_('Binary file')}
+ %else:
% if c.files_list.size < c.cut_off_limit:
${h.pygmentize(c.files_list,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")}
%else:
@@ -71,7 +74,8 @@
}
highlight_lines(h_lines);
}
-
+
+ %endif