提交 c40cba54 编写于 作者: K kohsuke

performa name safety check on rename (#1337)


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@7486 71c3de6d-444a-0410-be80-ed276b4c234a
上级 8c69a750
......@@ -11,6 +11,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import java.text.ParseException;
/**
* Displays {@link Job}s in a flat list view.
......@@ -97,7 +98,7 @@ public class ListView extends View {
/**
* Accepts submission from the configuration page.
*/
public synchronized void doConfigSubmit( StaplerRequest req, StaplerResponse rsp ) throws IOException {
public synchronized void doConfigSubmit( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
checkPermission(CONFIGURE);
req.setCharacterEncoding("UTF-8");
......@@ -110,11 +111,18 @@ public class ListView extends View {
description = Util.nullify(req.getParameter("description"));
name = req.getParameter("name");
try {
String n = req.getParameter("name");
Hudson.checkGoodName(n);
name = n;
} catch (ParseException e) {
sendError(e, req, rsp);
return;
}
owner.save();
rsp.sendRedirect("../"+ req.getParameter("name"));
rsp.sendRedirect("../"+name);
}
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册