未验证 提交 5503dd11 编写于 作者: Y Yaroslav 提交者: GitHub

Encode cloud name in `Cloud#getUrl` (#7573)

Co-authored-by: NYaroslav Afenkin <yaroslavafenkin@users.noreply.github.com>
上级 632700b8
......@@ -122,7 +122,7 @@ public abstract class Cloud extends Actionable implements ExtensionPoint, Descri
* @return Jenkins relative URL.
*/
public @NonNull String getUrl() {
return "cloud/" + name;
return "cloud/" + Util.rawEncode(name);
}
@Override
......
......@@ -78,6 +78,13 @@ public class CloudTest {
assertThat(out, containsString("doIndex called")); // doIndex
}
@Test
public void cloudNameIsEncodedInGetUrl() {
ACloud aCloud = new ACloud("../../gibberish", "0");
assertEquals("Cloud name is encoded in Cloud#getUrl", "cloud/..%2F..%2Fgibberish", aCloud.getUrl());
}
public static final class ACloud extends AbstractCloudImpl {
protected ACloud(String name, String instanceCapStr) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册