提交 839c26d1 编写于 作者: M mindless

[FIXED HUDSON-117] If next/previousBuild link jumps to an action not present

in that build (like testReport) then redirect up to the build page.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@14099 71c3de6d-444a-0410-be80-ed276b4c234a
上级 75e2fbf4
......@@ -1271,4 +1271,21 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
return Mailer.DESCRIPTOR.getAdminAddress();
}
}
@Override
public Object getDynamic(String token, StaplerRequest req, StaplerResponse rsp) {
Object result = super.getDynamic(token, req, rsp);
if (result == null)
// Next/Previous Build links on an action page (like /job/Abc/123/testReport)
// will also point to same action (/job/Abc/124/testReport), but other builds
// may not have the action.. rather than 404, redirect up to the build page.
result = new RedirectUp();
return result;
}
public static class RedirectUp {
public void doDynamic(StaplerRequest req, StaplerResponse rsp) throws IOException {
rsp.sendRedirect("..");
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册