String pathString = path.toString();
// transformation for Windows OS
pathString = StringUtils.addStart(pathString.replace("\\", "/"), "/");
+ // space is replaced with %20
+ pathString = pathString.replaceAll(" ","%20");
uri = URI.create("jar:file:" + pathString);
}
import org.junit.rules.TemporaryFolder;
import org.pf4j.plugin.PluginZip;
+import java.io.File;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
instance.find(getPluginsRoot().resolve("test-plugin-3"));
}
+ @Test
+ public void testSpaceCharacterInFileName() throws Exception {
+ PluginDescriptorFinder instance = new PropertiesPluginDescriptorFinder();
+ File jar = testFolder.newFile("my plugin-1.2.3.jar");
+
+ PluginZip pluginJar = new PluginZip.Builder(jar, "myPlugin")
+ .pluginVersion("1.2.3")
+ .build();
+
+ PluginDescriptor pluginDescriptor = instance.find(pluginJar.path());
+ assertNotNull(pluginDescriptor);
+ }
+
private List<String> getPlugin1Properties() {
String[] lines = new String[] {
"plugin.id=test-plugin-1\n"