plugins: fix print of url when it contains spaces
This commit is contained in:
parent
380fe52b30
commit
2c618a11de
|
@ -34,6 +34,7 @@ import org.elasticsearch.plugins.PluginManager.OutputMode;
|
|||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.Locale;
|
||||
|
||||
import static org.elasticsearch.common.cli.CliToolConfig.Builder.cmd;
|
||||
|
@ -221,7 +222,7 @@ public class PluginManagerCliParser extends CliTool {
|
|||
if (name != null) {
|
||||
terminal.println("-> Installing " + Strings.coalesceToEmpty(name) + "...");
|
||||
} else {
|
||||
terminal.println("-> Installing from " + url + "...");
|
||||
terminal.println("-> Installing from " + URLDecoder.decode(url.toString(), "UTF-8") + "...");
|
||||
}
|
||||
pluginManager.downloadAndExtract(name, terminal);
|
||||
return ExitStatus.OK;
|
||||
|
|
|
@ -19,12 +19,14 @@
|
|||
|
||||
package org.elasticsearch.plugins;
|
||||
|
||||
import org.elasticsearch.common.cli.CliTool;
|
||||
import org.elasticsearch.common.cli.CliToolTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.elasticsearch.common.cli.CliTool.ExitStatus.OK_AND_EXIT;
|
||||
import static org.elasticsearch.common.cli.CliTool.ExitStatus.IO_ERROR;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
public class PluginManagerCliTests extends CliToolTestCase {
|
||||
|
@ -50,4 +52,11 @@ public class PluginManagerCliTests extends CliToolTestCase {
|
|||
assertThat(new PluginManagerCliParser(terminal).execute(args("list -h")), is(OK_AND_EXIT));
|
||||
assertTerminalOutputContainsHelpFile(terminal, "/org/elasticsearch/plugins/plugin-list.help");
|
||||
}
|
||||
|
||||
public void testUrlSpacesInPath() {
|
||||
CliToolTestCase.CaptureOutputTerminal terminal = new CliToolTestCase.CaptureOutputTerminal();
|
||||
CliTool.ExitStatus execute = new PluginManagerCliParser(terminal).execute(args("install file://foo%20deps"));
|
||||
assertThat(execute.status(), is(IO_ERROR.status()));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue