Skip to content

Commit e68cd3a

Browse files
committed
Fix filter for symlinks
1 parent d619ab8 commit e68cd3a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/archiveDirectory.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,16 @@ async function zipDirectory(
142142
throw err;
143143
}
144144
// For security, filter out all symlinks
145-
const realFiles = await Promise.all(
146-
files.filter(async (f) => {
145+
const realFiles: typeof files = [];
146+
await Promise.all(
147+
files.map(async (f) => {
147148
const stats = await fs.promises.lstat(f.name);
148-
return !stats.isSymbolicLink();
149+
if (!stats.isSymbolicLink()) {
150+
realFiles.push(f);
151+
}
149152
}),
150153
);
154+
151155
for (const file of realFiles) {
152156
const name = path.relative(sourceDirectory, file.name);
153157
allFiles.push(name);

0 commit comments

Comments
 (0)