From 9b586584a14bf0aa926897d94e7a4bf60c2c9692 Mon Sep 17 00:00:00 2001
From: prometheansacrifice <3097018+ManasJayanth@users.noreply.github.com>
Date: Mon, 29 Jul 2024 07:06:19 +0530
Subject: [PATCH] Fix tarballs containing paths from fs root (#31)

---
 dist/index.js | 2 +-
 index.ts      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dist/index.js b/dist/index.js
index d3cbd55..29d40c2 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -139707,7 +139707,7 @@ function uncompress(dest, tarFile, strip) {
 function compress(dir, outputFile) {
     return __awaiter(this, void 0, void 0, function* () {
         return new Promise((resolve, reject) => {
-            create({ z: true }, [dir])
+            create({ z: true, C: external_path_.dirname(dir) }, [dir])
                 .pipe(external_fs_.createWriteStream(outputFile))
                 .on("close", () => resolve())
                 .on("error", reject);
diff --git a/index.ts b/index.ts
index ff9113c..e410ce2 100644
--- a/index.ts
+++ b/index.ts
@@ -281,7 +281,7 @@ async function uncompress(
 async function compress(dir: string, outputFile: string): Promise<void> {
   return new Promise((resolve, reject) => {
     tar
-      .c({ z: true }, [dir])
+      .c({ z: true, C: path.dirname(dir) }, [dir])
       .pipe(fs.createWriteStream(outputFile))
       .on("close", () => resolve())
       .on("error", reject);