Skip to content

Commit

Permalink
Fix es unzip (#21817) (#21839)
Browse files Browse the repository at this point in the history
* Rebuild modulePath correctly if on Windows

* fix it so we create empty dirs like /logs/
  • Loading branch information
Lee Drengenberg committed Aug 27, 2018
1 parent 1b408ed commit 9cc037c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/kbn-es/src/utils/decompress.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ function decompressTarball(archive, dirPath) {
}

function decompressZip(input, output) {
mkdirp.sync(output);
return new Promise((resolve, reject) => {
yauzl.open(input, { lazyEntries: true }, (err, zipfile) => {
if (err) {
Expand All @@ -62,6 +63,7 @@ function decompressZip(input, output) {
const fileName = path.resolve(output, zipPath);

if (/\/$/.test(entry.fileName)) {
mkdirp.sync(fileName);
zipfile.readEntry();
} else {
// file entry
Expand All @@ -74,9 +76,7 @@ function decompressZip(input, output) {
zipfile.readEntry();
});

mkdirp(path.dirname(fileName), () => {
readStream.pipe(fs.createWriteStream(fileName));
});
readStream.pipe(fs.createWriteStream(fileName));
});
}
});
Expand Down

0 comments on commit 9cc037c

Please sign in to comment.