diff --git a/core/src/main/java/hudson/logging/LogRecorderManager.java b/core/src/main/java/hudson/logging/LogRecorderManager.java index 25044984fa25..0d468f8c9c8c 100644 --- a/core/src/main/java/hudson/logging/LogRecorderManager.java +++ b/core/src/main/java/hudson/logging/LogRecorderManager.java @@ -173,7 +173,7 @@ public HttpResponse doNewLogRecorder(@QueryParameter String name) { recorders.add(new LogRecorder(name)); // redirect to the config screen - return new HttpRedirect(name + "/configure"); + return new HttpRedirect(Util.rawEncode(name) + "/configure"); } @Restricted(NoExternalUse.class) diff --git a/test/src/test/java/hudson/logging/LogRecorderManagerTest.java b/test/src/test/java/hudson/logging/LogRecorderManagerTest.java index 9ed1481e83ae..81ae762b25fc 100644 --- a/test/src/test/java/hudson/logging/LogRecorderManagerTest.java +++ b/test/src/test/java/hudson/logging/LogRecorderManagerTest.java @@ -35,6 +35,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; +import hudson.Util; import hudson.XmlFile; import hudson.model.Computer; import hudson.model.Saveable; @@ -130,6 +131,19 @@ void logRecorderCheckName() { assertEquals(FormValidation.ok(), testRecorder.doCheckName("a", Level.OFF.getName())); } + @Test + void createLogRecorderWithNonAsciiName() throws Exception { + String name = "Journal d’accès"; + + HtmlPage page = j.createWebClient().goTo("log/new"); + HtmlForm form = page.getFormByName("configSubmit"); + form.getInputByName("name").setValueAttribute(name); + j.submit(form); + + assertNotNull(j.jenkins.getLog().getLogRecorder(name)); + j.createWebClient().goTo("log/" + Util.rawEncode(name) + "/configure"); + } + @Issue({"JENKINS-18274", "JENKINS-63458"}) @Test void loggingOnSlaves() throws Exception {