Skip to content

Commit

Permalink
[FIXED JENKINS-18373] View.doConfigSubmit must rawEncode its name.
Browse files Browse the repository at this point in the history
  • Loading branch information
jglick committed Jun 17, 2013
1 parent fe70d19 commit 8032848
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
3 changes: 3 additions & 0 deletions changelog.html
Expand Up @@ -61,6 +61,9 @@
<li class=bug>
“Build Now” link did not work for multijobs.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-16974">issue 16974</a>)
<li class=bug>
Edit views with non-ASCII names did not work since 1.500.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-18373">issue 18373</a>)
<li class='major bug'>
Fixed API incompatibility since 1.489.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-18356">issue 18356</a>)
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/model/View.java
Expand Up @@ -962,7 +962,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
15 changes: 15 additions & 0 deletions test/src/test/java/hudson/model/ViewTest.java
Expand Up @@ -35,6 +35,7 @@

import static hudson.model.Messages.Hudson_ViewName;
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 @@ -157,4 +158,18 @@ public class ViewTest {
assertEquals(400, e.getStatusCode());
}
}

@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 8032848

Please sign in to comment.