From 9c37fa86d1410bb917dd5f5da4dbc013918633e5 Mon Sep 17 00:00:00 2001 From: 5saviahv <5saviahv@users.noreply.github.com> Date: Sat, 1 Jun 2024 12:15:12 +0300 Subject: [PATCH] minor fixes found from issues --- adm-zip.js | 4 +++- package.json | 2 +- zipEntry.js | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/adm-zip.js b/adm-zip.js index f38797d..33316f6 100644 --- a/adm-zip.js +++ b/adm-zip.js @@ -429,7 +429,7 @@ module.exports = function (/**String*/ input, /** object */ options) { // prepare new entry if (!update) { entry = new ZipEntry(); - entry.entryName = entryName; + entry.entryName = Utils.canonical(entryName); } entry.comment = comment || ""; @@ -464,6 +464,8 @@ module.exports = function (/**String*/ input, /** object */ options) { entry.setData(content); if (!update) _zip.setEntry(entry); + + return entry; }, /** diff --git a/package.json b/package.json index 8263801..54f8d2d 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "url": "https://github.com/cthackers/adm-zip.git" }, "engines": { - "node": ">=6.0" + "node": ">=12.0" }, "devDependencies": { "chai": "^4.3.4", diff --git a/zipEntry.js b/zipEntry.js index 9deed1f..486e092 100644 --- a/zipEntry.js +++ b/zipEntry.js @@ -12,7 +12,8 @@ module.exports = function (/*Buffer*/ input) { _extra = Buffer.alloc(0); function getCompressedDataFromZip() { - if (!input || !Buffer.isBuffer(input)) { + //if (!input || !Buffer.isBuffer(input)) { + if (!input || !(input instanceof Uint8Array)) { return Buffer.alloc(0); } _centralHeader.loadLocalHeaderFromBinary(input);