From 8bed6191f52929d70e4b50db9ee8175a0be6312b Mon Sep 17 00:00:00 2001 From: Johannes Gilger Date: Fri, 30 Jan 2009 10:32:26 +0100 Subject: [PATCH] diffHighlighter.js: Bail out early for deleted binary/image files If we have an image (png,jpg,...) which was deleted we cant display a diff or the file itself anymore. In this case the entry in the file-list is enough. --- html/lib/diffHighlighter.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/html/lib/diffHighlighter.js b/html/lib/diffHighlighter.js index 0ece7e1..8f51c5d 100644 --- a/html/lib/diffHighlighter.js +++ b/html/lib/diffHighlighter.js @@ -56,6 +56,16 @@ var highlightDiff = function(diff, element, callbacks) { title = endname; else if (startname != endname) title = startname + " renamed to " + endname; + + if (binary && endname == "/dev/null") { // in cases of a deleted binary file, there is no diff/file to display + line1 = ""; + line2 = ""; + diffContent = ""; + file_index++; + startname = ""; + endname = ""; + return; // so printing the filename in the file-list is enough + } finalContent += '
' + '
' + title + '
';