Skip to content

Commit

Permalink
fixed JENKINS-11058
Browse files Browse the repository at this point in the history
  • Loading branch information
mspring committed Oct 11, 2011
1 parent 010859d commit 3e77b35
Showing 1 changed file with 9 additions and 8 deletions.
Expand Up @@ -78,14 +78,15 @@ public void doFilter(ServletRequest req, ServletResponse rsp, FilterChain chain)

if ( !disabled && redirectTarget != null && redirectTarget.length() > 0 && uri.startsWith("/user/")){
String username = uri.substring(6);
while (username.endsWith("/")) username = username.substring(0,username.length()-1);
HttpServletResponse hrsp = (HttpServletResponse)rsp;
hrsp.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);

String newUri = redirectTarget.replace("${user}",username);
LOG.fine("redirecting to "+newUri);
hrsp.addHeader("Location",newUri);
return;
if (username.indexOf('/') < 0){
HttpServletResponse hrsp = (HttpServletResponse)rsp;
hrsp.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);

String newUri = redirectTarget.replace("${user}",username);
LOG.fine("redirecting to "+newUri);
hrsp.addHeader("Location",newUri);
return;
}
}

chain.doFilter(req, rsp);
Expand Down

0 comments on commit 3e77b35

Please sign in to comment.