Skip to content

Commit

Permalink
Fixed extraction of site plugins downloaded from github, so that we s…
Browse files Browse the repository at this point in the history
…kip the top-level folder and we place the files directly under the _site folder

Closes elastic#3551
  • Loading branch information
javanna committed Aug 27, 2013
1 parent 979fe3a commit 3a275a9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main/java/org/elasticsearch/plugins/PluginManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public void downloadAndExtract(String name, boolean verbose) throws IOException
if (elements.length > 2) {
version = elements[2];
}
filterZipName = userName + "-" + repoName;
filterZipName = repoName;
// the installation file should not include the userName, just the repoName
name = repoName;
if (name.startsWith("elasticsearch-")) {
Expand Down Expand Up @@ -225,13 +225,13 @@ public void downloadAndExtract(String name, boolean verbose) throws IOException
if (zipEntry.isDirectory()) {
continue;
}
String zipName = zipEntry.getName().replace('\\', '/');
String zipEntryName = zipEntry.getName().replace('\\', '/');
if (filterZipName != null) {
if (zipName.startsWith(filterZipName)) {
zipName = zipName.substring(zipName.indexOf('/'));
if (zipEntryName.startsWith(filterZipName)) {
zipEntryName = zipEntryName.substring(zipEntryName.indexOf('/'));
}
}
File target = new File(extractLocation, zipName);
File target = new File(extractLocation, zipEntryName);
FileSystemUtils.mkdirs(target.getParentFile());
Streams.copy(zipFile.getInputStream(zipEntry), new FileOutputStream(target));
}
Expand Down

0 comments on commit 3a275a9

Please sign in to comment.