Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FIXED JENKINS-18373] View.doConfigSubmit must rawEncode its name.
(cherry picked from commit 8032848)

Conflicts:
	changelog.html
	test/src/test/java/hudson/model/ViewTest.java
  • Loading branch information
jglick authored and olivergondza committed Sep 17, 2013
1 parent a8e3b4f commit 3a527ec
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/model/View.java
Expand Up @@ -933,7 +933,7 @@ public final synchronized void doConfigSubmit( StaplerRequest req, StaplerRespon

save();

FormApply.success("../"+name).generateResponse(req,rsp,this);
FormApply.success("../" + Util.rawEncode(name)).generateResponse(req,rsp,this);
}

/**
Expand Down
14 changes: 14 additions & 0 deletions test/src/test/java/hudson/model/ViewTest.java
Expand Up @@ -39,6 +39,7 @@
import static hudson.model.Messages.Hudson_ViewName;
import java.io.File;
import static org.junit.Assert.*;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.JenkinsRule;
Expand Down Expand Up @@ -178,4 +179,17 @@ public class ViewTest {
xml = new XmlFile(Jenkins.XSTREAM, new File(j.jenkins.getRootDir(), "config.xml")).asString();
assertTrue(xml, xml.contains("<description>two</description>"));
}

@Ignore("verified manually in Winstone but org.mortbay.JettyResponse.sendRedirect (6.1.26) seems to mangle the location")
@Bug(18373)
@Test public void unicodeName() throws Exception {
HtmlForm form = j.createWebClient().goTo("newView").getFormByName("createItem");
String name = "I ♥ NY";
form.getInputByName("name").setValueAttribute(name);
form.getRadioButtonsByName("mode").get(0).setChecked(true);
j.submit(form);
View view = j.jenkins.getView(name);
assertNotNull(view);
j.submit(j.createWebClient().getPage(view, "configure").getFormByName("viewConfig"));
}
}

0 comments on commit 3a527ec

Please sign in to comment.