提交 5f1c3fc8 编写于 作者: M mindless

after new job creation, remove view/{default-view} from redirect URL if created in default view


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@23529 71c3de6d-444a-0410-be80-ed276b4c234a
上级 ebb58009
......@@ -24,6 +24,7 @@
package hudson.model;
import com.thoughtworks.xstream.XStream;
import groovy.lang.GroovyShell;
import hudson.BulkChange;
import hudson.FilePath;
import hudson.Functions;
......@@ -125,6 +126,7 @@ import org.apache.commons.logging.LogFactory;
import org.apache.commons.jelly.Script;
import org.apache.commons.jelly.JellyException;
import org.apache.commons.io.FileUtils;
import org.kohsuke.stapler.Ancestor;
import org.kohsuke.stapler.MetaClass;
import org.kohsuke.stapler.Stapler;
import org.kohsuke.stapler.StaplerProxy;
......@@ -200,8 +202,6 @@ import java.nio.charset.Charset;
import javax.servlet.RequestDispatcher;
import javax.crypto.SecretKey;
import groovy.lang.GroovyShell;
/**
* Root object of the system.
*
......@@ -2460,7 +2460,17 @@ public final class Hudson extends Node implements ItemGroup<TopLevelItem>, Stapl
}
// send the browser to the config page
rsp.sendRedirect2(result.getUrl()+"configure");
// use View to trim view/{default-view} from URL if possible
String redirect = result.getUrl()+"configure";
List<Ancestor> ancestors = req.getAncestors();
for (int i = ancestors.size() - 1; i >= 0; i--) {
Object o = ancestors.get(i).getObject();
if (o instanceof View) {
redirect = req.getContextPath() + '/' + ((View)o).getUrl() + redirect;
break;
}
}
rsp.sendRedirect2(redirect);
return result;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册