提交 46d604dd 编写于 作者: M mindless

[FIXED HUDSON-2341] Colored ball image at top of build pages was broken

for Hudson in some web containers. Fixed by removing workaround (r323)
for a Firefox bug (https://bugzilla.mozilla.org/show_bug.cgi?id=89419),
fixed since 3.0.5 (Dec, 2008).


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@29855 71c3de6d-444a-0410-be80-ed276b4c234a
上级 9fec8e07
......@@ -174,7 +174,6 @@ import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST;
import static javax.servlet.http.HttpServletResponse.SC_NOT_FOUND;
import java.io.File;
import java.io.FileFilter;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
......@@ -2768,46 +2767,6 @@ public final class Hudson extends Node implements ItemGroup<TopLevelItem>, Stapl
}
}
/**
* Serves static resources without the "Last-Modified" header to work around
* a bug in Firefox.
*
* <p>
* See https://bugzilla.mozilla.org/show_bug.cgi?id=89419
*/
public void doNocacheImages( StaplerRequest req, StaplerResponse rsp ) throws IOException {
String path = req.getRestOfPath();
if(path.length()==0)
path = "/";
if(path.indexOf("..")!=-1 || path.length()<1) {
// don't serve anything other than files in the artifacts dir
rsp.sendError(SC_BAD_REQUEST);
return;
}
File f = new File(req.getServletContext().getRealPath("/images"),path.substring(1));
if(!f.exists()) {
rsp.sendError(SC_NOT_FOUND);
return;
}
if(f.isDirectory()) {
// listing not allowed
rsp.sendError(HttpServletResponse.SC_FORBIDDEN);
return;
}
FileInputStream in = new FileInputStream(f);
// serve the file
String contentType = req.getServletContext().getMimeType(f.getPath());
rsp.setContentType(contentType);
rsp.setContentLength((int)f.length());
Util.copyStream(in,rsp.getOutputStream());
in.close();
}
/**
* For debugging. Expose URL to perform GC.
*/
......
......@@ -1116,8 +1116,7 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
*/
public void doBuildStatus(StaplerRequest req, StaplerResponse rsp)
throws IOException {
rsp.sendRedirect2(req.getContextPath() + "/nocacheImages/48x48/"
+ getBuildStatusUrl());
rsp.sendRedirect2(req.getContextPath() + "/images/48x48/" + getBuildStatusUrl());
}
public String getBuildStatusUrl() {
......
......@@ -1429,8 +1429,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
}
public void doBuildStatus( StaplerRequest req, StaplerResponse rsp ) throws IOException {
// see Hudson.doNocacheImages. this is a work around for a bug in Firefox
rsp.sendRedirect2(req.getContextPath()+"/nocacheImages/48x48/"+getBuildStatusUrl());
rsp.sendRedirect2(req.getContextPath()+"/images/48x48/"+getBuildStatusUrl());
}
public String getBuildStatusUrl() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册