diff --git a/kallithea/templates/changeset/diff_block.html b/kallithea/templates/changeset/diff_block.html
--- a/kallithea/templates/changeset/diff_block.html
+++ b/kallithea/templates/changeset/diff_block.html
@@ -75,7 +75,7 @@
${diff|n}
- %if cs_filename.rsplit('.')[-1] in ['png', 'gif', 'jpg', 'bmp']:
+ %if op and cs_filename.rsplit('.')[-1] in ['png', 'gif', 'jpg', 'bmp']:
Show images
%if op == 'M':
Press to swap images
diff --git a/kallithea/tests/functional/test_files.py b/kallithea/tests/functional/test_files.py
--- a/kallithea/tests/functional/test_files.py
+++ b/kallithea/tests/functional/test_files.py
@@ -765,3 +765,19 @@ class TestFilesController(TestController
'Successfully deleted file %s' % posixpath.join(location, filename))
finally:
fixture.destroy_repo(repo.repo_name)
+
+ def test_png_diff_no_crash_hg(self):
+ self.log_user()
+ response = self.app.get(url('files_diff_home',
+ repo_name=HG_REPO,
+ f_path='docs/theme/ADC/static/documentation.png',
+ diff1='tip', diff2='tip'))
+ response.mustcontain("""
Binary file
""")
+
+ def test_png_diff_no_crash_git(self):
+ self.log_user()
+ response = self.app.get(url('files_diff_home',
+ repo_name=GIT_REPO,
+ f_path='docs/theme/ADC/static/documentation.png',
+ diff1='master', diff2='master'))
+ response.mustcontain("""
Binary file
""")