提交 70ee74c5 编写于 作者: D Dave Hunt 提交者: Kohsuke Kawaguchi

[FIXED JENKINS-13640] Allow file parameters to be viewed as plain text.

上级 af0af449
......@@ -60,6 +60,9 @@ Upcoming changes</a>
<li class=bug>
Fixed nested view not showing up with just read perm for View
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-13429">issue 13429</a>)
<li class=rfe>
Allow file parameters to be viewed as plain text.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-13640">issue 13640</a>)
<li class=rfe>
Improve the low disk space warning message.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-13826">issue 13826</a>)
......
......@@ -181,7 +181,14 @@ public class FileParameterValue extends ParameterValue {
AbstractBuild build = (AbstractBuild)request.findAncestor(AbstractBuild.class).getObject();
File fileParameter = getLocationUnderBuild(build);
if (fileParameter.isFile()) {
response.serveFile(request, fileParameter.toURI().toURL());
InputStream data = new FileInputStream(fileParameter);
long lastModified = fileParameter.lastModified();
long contentLength = fileParameter.length();
if (request.hasParameter("view")) {
response.serveFile(request, data, lastModified, contentLength, "plain.txt");
} else {
response.serveFile(request, data, lastModified, contentLength, originalFileName);
}
}
}
}
......
......@@ -31,7 +31,10 @@ THE SOFTWARE.
<j:invokeStatic var="encodedName" className="hudson.Util" method="rawEncode">
<j:arg value="${it.name}" />
</j:invokeStatic>
<a href="parameter/${encodedName}/${it.originalFileName}">${it.originalFileName}</a>
<j:set var="path" value="parameter/${encodedName}/${it.originalFileName}"/>
<a href="${path}">${it.originalFileName}</a>
<st:nbsp/>
<a href="${path}?view">${%view}</a>
</j:if>
</f:entry>
</j:jelly>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册