Skip to content

Commit b8b92e6

Browse files
committed
PBWebGit: escape diff before inserting it into to the view
We used to escape a diff only after it was formatted. This would cause some elements to hang the interface (like an iFrame)
1 parent 60db4c4 commit b8b92e6

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

html/commit.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ var selectCommit = function(a) {
3434

3535
var showDiffs = function() {
3636
$("details").hide();
37-
$("details").innerHTML = commit.diff;
37+
38+
$("details").innerHTML = commit.diff.escapeHTML();
39+
3840
highlightDiffs();
3941
$("details").show();
4042
}

html/diffHighlighter.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var highlightDiffs = function() {
1212
if (l.length > 100)
1313
l = l.substring(0, 100);
1414

15-
l = l.escapeHTML().gsub("\t", " ");
15+
l = l.gsub("\t", " ");
1616

1717
if (l.startsWith("+"))
1818
newContent += "<div class='addline'>" + l + "</div>";

0 commit comments

Comments
 (0)