htn-tunnel 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/install.js +4 -2
- package/package.json +1 -1
package/lib/install.js
CHANGED
|
@@ -89,7 +89,8 @@ function extractTarGz(gzData, filename, dest) {
|
|
|
89
89
|
const sizeStr = header.toString("utf8", 124, 136).replace(/\0/g, "").trim();
|
|
90
90
|
const size = parseInt(sizeStr, 8) || 0;
|
|
91
91
|
offset += 512;
|
|
92
|
-
|
|
92
|
+
const baseName = name.split("/").pop();
|
|
93
|
+
if (baseName === filename) {
|
|
93
94
|
fs.writeFileSync(dest, tarData.subarray(offset, offset + size));
|
|
94
95
|
return;
|
|
95
96
|
}
|
|
@@ -108,7 +109,8 @@ function extractZip(zipData, filename, dest) {
|
|
|
108
109
|
const extraLen = zipData.readUInt16LE(offset + 28);
|
|
109
110
|
const name = zipData.toString("utf8", offset + 30, offset + 30 + nameLen);
|
|
110
111
|
const dataStart = offset + 30 + nameLen + extraLen;
|
|
111
|
-
|
|
112
|
+
const baseName = name.split("/").pop();
|
|
113
|
+
if (baseName === filename) {
|
|
112
114
|
if (compMethod === 0) {
|
|
113
115
|
fs.writeFileSync(dest, zipData.subarray(dataStart, dataStart + compSize));
|
|
114
116
|
} else {
|