Skip to content

Commit 1b34478

Browse files
committed
Extract zstd files too
1 parent 7673a2d commit 1b34478

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/artifact-scanner.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,26 @@ async function scanArchiveFile(
127127
await exec.exec("tar", ["-xzf", archivePath, "-C", tempExtractDir], {
128128
silent: true,
129129
});
130+
} else if (fileName.endsWith(".tar.zst")) {
131+
// Extract tar.zst files
132+
logger.debug(`Extracting tar.zst file: ${archivePath}`);
133+
await exec.exec(
134+
"tar",
135+
["--zstd", "-xf", archivePath, "-C", tempExtractDir],
136+
{
137+
silent: true,
138+
},
139+
);
140+
} else if (fileName.endsWith(".zst")) {
141+
// Extract .zst files (single file compression)
142+
logger.debug(`Extracting zst file: ${archivePath}`);
143+
const outputFile = path.join(
144+
tempExtractDir,
145+
path.basename(archivePath, ".zst"),
146+
);
147+
await exec.exec("zstd", ["-d", archivePath, "-o", outputFile], {
148+
silent: true,
149+
});
130150
} else if (fileName.endsWith(".gz")) {
131151
// Extract .gz files (single file compression)
132152
logger.debug(`Extracting gz file: ${archivePath}`);
@@ -199,6 +219,8 @@ async function scanFile(
199219
fileName.endsWith(".zip") ||
200220
fileName.endsWith(".tar.gz") ||
201221
fileName.endsWith(".tgz") ||
222+
fileName.endsWith(".tar.zst") ||
223+
fileName.endsWith(".zst") ||
202224
fileName.endsWith(".gz");
203225

204226
if (isArchive) {

0 commit comments

Comments
 (0)