diff --git a/src/main/java/htmlpublisher/HtmlPublisher.java b/src/main/java/htmlpublisher/HtmlPublisher.java
index dc86d9e..09e507b 100644
--- a/src/main/java/htmlpublisher/HtmlPublisher.java
+++ b/src/main/java/htmlpublisher/HtmlPublisher.java
@@ -81,6 +81,8 @@
import edu.umd.cs.findbugs.annotations.NonNull;
+import static hudson.Functions.htmlAttributeEscape;
+
/**
* Saves HTML reports for the project and publishes them.
@@ -130,7 +132,7 @@ private static String writeFile(List lines, File path) throws IOExceptio
return Util.toHexString(sha1.digest());
}
- public List readFile(String filePath) throws
+ public List readFile(String filePath) throws
java.io.IOException {
return readFile(filePath, this.getClass());
}
@@ -302,7 +304,7 @@ public static boolean publishReports(Run, ?> build, FilePath workspace, TaskLi
// On windows file paths contains back slashes, but
// in the HTML file we do not want them, so replace them with forward slash
report = report.replace("\\", "/");
-
+
// Ignore blank report names caused by trailing or double commas.
if (report.isEmpty()) {
continue;
@@ -318,13 +320,13 @@ public static boolean publishReports(Run, ?> build, FilePath workspace, TaskLi
} else {
reportFile = report;
}
- String tabItem = "" + getTitle(reportFile, titles, j) + "";
+ String tabItem = "" + htmlAttributeEscape(getTitle(reportFile, titles, j)) + "";
reportLines.add(tabItem);
}
// Add the JS to change the link as appropriate.
String hudsonUrl = Jenkins.get().getRootUrl();
Job job = build.getParent();
- reportLines.add("");
+ reportLines.add("");
// If the URL isn't configured in Hudson, the best we can do is attempt to go Back.
if (hudsonUrl == null) {
reportLines.add("");
diff --git a/src/main/resources/htmlpublisher/HtmlPublisherTarget/BaseHTMLAction/index.groovy b/src/main/resources/htmlpublisher/HtmlPublisherTarget/BaseHTMLAction/index.groovy
index 51e94b3..ab0b282 100644
--- a/src/main/resources/htmlpublisher/HtmlPublisherTarget/BaseHTMLAction/index.groovy
+++ b/src/main/resources/htmlpublisher/HtmlPublisherTarget/BaseHTMLAction/index.groovy
@@ -3,6 +3,7 @@ package htmlpublisher.HtmlPublisherTarget.BaseHTMLAction
import htmlpublisher.HtmlPublisher
import htmlpublisher.HtmlPublisherTarget
import hudson.Util
+import hudson.model.Descriptor
import java.security.MessageDigest
@@ -57,6 +58,30 @@ def serveWrapperLegacyDirectly() {
def legacyFile = new File(my.dir(), "htmlpublisher-wrapper.html")
+ def scriptPattern = legacyFile.text =~ /(
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+