Skip to content

Commit f1f01aa

Browse files
committed
security-2888
1 parent 0b396e1 commit f1f01aa

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

src/main/java/hudson/tasks/test/TestResult.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,7 @@ public String toPrettyString() {
278278
public String annotate(String text) {
279279
if (text == null)
280280
return null;
281-
text = text.replace("&", "&amp;").replace("<", "&lt;").replaceAll(
282-
"\\b(https?://[^\\s)>]+)", "<a href=\"$1\">$1</a>");
281+
text = text.replace("&", "&amp;").replace("<", "&lt;");
283282

284283
for (TestAction action: getTestActions()) {
285284
text = action.annotate(text);

src/test/java/hudson/tasks/junit/CaseResultTest.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -85,24 +85,24 @@ public void testIssue20090516() throws Exception {
8585
// piggy back tests for annotate methods
8686
assertOutput(cr,"plain text", "plain text");
8787
assertOutput(cr,"line #1\nhttp://nowhere.net/\nline #2\n",
88-
"line #1\n<a href=\"http://nowhere.net/\">http://nowhere.net/</a>\nline #2\n");
88+
"line #1\nhttp://nowhere.net/\nline #2\n");
8989
assertOutput(cr,"failed; see http://nowhere.net/",
90-
"failed; see <a href=\"http://nowhere.net/\">http://nowhere.net/</a>");
90+
"failed; see http://nowhere.net/");
9191
assertOutput(cr,"failed (see http://nowhere.net/)",
92-
"failed (see <a href=\"http://nowhere.net/\">http://nowhere.net/</a>)");
92+
"failed (see http://nowhere.net/)");
9393
assertOutput(cr,"http://nowhere.net/ - failed: http://elsewhere.net/",
94-
"<a href=\"http://nowhere.net/\">http://nowhere.net/</a> - failed: " +
95-
"<a href=\"http://elsewhere.net/\">http://elsewhere.net/</a>");
94+
"http://nowhere.net/ - failed: " +
95+
"http://elsewhere.net/");
9696
assertOutput(cr,"https://nowhere.net/",
97-
"<a href=\"https://nowhere.net/\">https://nowhere.net/</a>");
97+
"https://nowhere.net/");
9898
assertOutput(cr,"stuffhttp://nowhere.net/", "stuffhttp://nowhere.net/");
9999
assertOutput(cr,"a < b && c < d", "a &lt; b &amp;&amp; c &lt; d");
100100
assertOutput(cr,"see <http://nowhere.net/>",
101-
"see &lt;<a href=\"http://nowhere.net/\">http://nowhere.net/</a>>");
101+
"see &lt;http://nowhere.net/>");
102102
assertOutput(cr,"http://google.com/?q=stuff&lang=en",
103-
"<a href=\"http://google.com/?q=stuff&amp;lang=en\">http://google.com/?q=stuff&amp;lang=en</a>");
103+
"http://google.com/?q=stuff&amp;lang=en");
104104
assertOutput(cr,"http://localhost:8080/stuff/",
105-
"<a href=\"http://localhost:8080/stuff/\">http://localhost:8080/stuff/</a>");
105+
"http://localhost:8080/stuff/");
106106
}
107107

108108

0 commit comments

Comments
 (0)