Skip to content

Commit d75584c

Browse files
authored
Merge pull request #111 from muhqu/fix-hyperlinks
Fix hyperlinks in commit messages
2 parents 72ae476 + 34b5947 commit d75584c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Resources/html/views/history/history.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,14 @@ var loadCommit = function(commitObject, currentRef) {
175175
$("committerDate").parentNode.style.display = "none";
176176
}
177177

178-
$("message").innerHTML = commit.message.replace(/\b(https?:\/\/[^\s<]*)/ig, "<a href=\"$1\">$1</a>").replace(/\n/g,"<br>");
178+
var textToHTML = function (txt) {
179+
return (" "+txt+" ")
180+
.replace(/(https?:\/\/([^\s\.\)\]\<]+|\.[^\s])+)/ig, "<a href=\"$1\">$1</a>")
181+
.replace(/\n/g,"<br>")
182+
.trim();
183+
}
184+
185+
$("message").innerHTML = textToHTML(commit.message);
179186

180187
jQuery("#commit").show();
181188
jQuery("#no-commit-message").hide();

0 commit comments

Comments
 (0)