mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Honor options.forceConvert in tryExtractWithNpmTar.
This commit is contained in:
@@ -745,6 +745,11 @@ function ensureDirectoryEmpty(dir) {
|
||||
function tryExtractWithNativeTar(buffer, tempDir, options) {
|
||||
ensureDirectoryEmpty(tempDir);
|
||||
|
||||
if (options.forceConvert) {
|
||||
return Promise.reject(new Error(
|
||||
"Native tar cannot convert colons in package names"));
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const flags = options.verbose ? "-xzvf" : "-xzf";
|
||||
const tarProc = spawn("tar", [flags, "-"], {
|
||||
@@ -767,6 +772,11 @@ function tryExtractWithNativeTar(buffer, tempDir, options) {
|
||||
function tryExtractWithNative7z(buffer, tempDir, options) {
|
||||
ensureDirectoryEmpty(tempDir);
|
||||
|
||||
if (options.forceConvert) {
|
||||
return Promise.reject(new Error(
|
||||
"Native 7z.exe cannot convert colons in package names"));
|
||||
}
|
||||
|
||||
const exeOSPath = files.convertToOSPath(
|
||||
files.pathJoin(files.getCurrentNodeBinDir(), "7z.exe"));
|
||||
const tarGzBasename = "out.tar.gz";
|
||||
@@ -829,6 +839,13 @@ function tryExtractWithNpmTar(buffer, tempDir, options) {
|
||||
var gunzip = zlib.createGunzip().on('error', reject);
|
||||
var extractor = new tar.Extract({
|
||||
path: files.convertToOSPath(tempDir)
|
||||
}).on('entry', function (e) {
|
||||
if (process.platform === "win32" || options.forceConvert) {
|
||||
// On Windows, try to convert old packages that have colons in
|
||||
// paths by blindly replacing all of the paths. Otherwise, we
|
||||
// can't even extract the tarball
|
||||
e.path = colonConverter.convert(e.path);
|
||||
}
|
||||
}).on('error', reject)
|
||||
.on('end', resolve);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user