Skip to content

Commit 4a47b85

Browse files
authored
Merge pull request #401 from netlify-team-account-1/master
Repro: Unzipping symlinks
2 parents 009ee26 + d7a04fb commit 4a47b85

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

test/assets/symlink.zip

563 Bytes
Binary file not shown.

test/mocha.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,21 @@ describe("adm-zip", () => {
172172
const zip2Entries = zip2.getEntries().map((e) => e.entryName);
173173
expect(zip2Entries).to.deep.equal(["c.txt", "b.txt", "a.txt"]);
174174
});
175+
176+
it("repro: symlink", () => {
177+
const zip = new Zip("./test/assets/symlink.zip");
178+
zip.extractAllTo(destination);
179+
180+
const linkPath = pth.join(destination, "link")
181+
const linkStat = fs.lstatSync(linkPath);
182+
expect(linkStat.isSymbolicLink()).to.be.true;
183+
184+
const linkTarget = fs.readlinkSync(linkPath);
185+
expect(linkTarget).to.equal("target")
186+
187+
const linkContent = fs.readFileSync(linkPath);
188+
expect(linkContent).to.equal("diddlydiddly doo, i'm a linkaroo")
189+
});
175190
});
176191

177192
function walk(dir) {

0 commit comments

Comments
 (0)