refactor: rename tar archive preflight checker

This commit is contained in:
Peter Steinberger
2026-03-10 23:52:51 +00:00
parent 6565ae1857
commit 9c64508822
2 changed files with 4 additions and 4 deletions

View File

@@ -1,7 +1,7 @@
import { createHash } from "node:crypto"; import { createHash } from "node:crypto";
import fs from "node:fs"; import fs from "node:fs";
import { import {
createTarEntrySafetyChecker, createTarEntryPreflightChecker,
extractArchive as extractArchiveSafe, extractArchive as extractArchiveSafe,
mergeExtractedTreeIntoDestination, mergeExtractedTreeIntoDestination,
prepareArchiveDestinationDir, prepareArchiveDestinationDir,
@@ -102,7 +102,7 @@ export async function extractArchive(params: {
code: 1, code: 1,
}; };
} }
const checkTarEntrySafety = createTarEntrySafetyChecker({ const checkTarEntrySafety = createTarEntryPreflightChecker({
rootDir: destinationRealDir, rootDir: destinationRealDir,
stripComponents: strip, stripComponents: strip,
escapeLabel: "targetDir", escapeLabel: "targetDir",

View File

@@ -505,7 +505,7 @@ function readTarEntryInfo(entry: unknown): TarEntryInfo {
return { path: p, type: t, size: s }; return { path: p, type: t, size: s };
} }
export function createTarEntrySafetyChecker(params: { export function createTarEntryPreflightChecker(params: {
rootDir: string; rootDir: string;
stripComponents?: number; stripComponents?: number;
limits?: ArchiveExtractLimits; limits?: ArchiveExtractLimits;
@@ -570,7 +570,7 @@ export async function extractArchive(params: {
await withStagedArchiveDestination({ await withStagedArchiveDestination({
destinationRealDir, destinationRealDir,
run: async (stagingDir) => { run: async (stagingDir) => {
const checkTarEntrySafety = createTarEntrySafetyChecker({ const checkTarEntrySafety = createTarEntryPreflightChecker({
rootDir: destinationRealDir, rootDir: destinationRealDir,
stripComponents: params.stripComponents, stripComponents: params.stripComponents,
limits, limits,