mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 07:20:45 +00:00
refactor: rename tar archive preflight checker
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { createHash } from "node:crypto";
|
||||
import fs from "node:fs";
|
||||
import {
|
||||
createTarEntrySafetyChecker,
|
||||
createTarEntryPreflightChecker,
|
||||
extractArchive as extractArchiveSafe,
|
||||
mergeExtractedTreeIntoDestination,
|
||||
prepareArchiveDestinationDir,
|
||||
@@ -102,7 +102,7 @@ export async function extractArchive(params: {
|
||||
code: 1,
|
||||
};
|
||||
}
|
||||
const checkTarEntrySafety = createTarEntrySafetyChecker({
|
||||
const checkTarEntrySafety = createTarEntryPreflightChecker({
|
||||
rootDir: destinationRealDir,
|
||||
stripComponents: strip,
|
||||
escapeLabel: "targetDir",
|
||||
|
||||
@@ -505,7 +505,7 @@ function readTarEntryInfo(entry: unknown): TarEntryInfo {
|
||||
return { path: p, type: t, size: s };
|
||||
}
|
||||
|
||||
export function createTarEntrySafetyChecker(params: {
|
||||
export function createTarEntryPreflightChecker(params: {
|
||||
rootDir: string;
|
||||
stripComponents?: number;
|
||||
limits?: ArchiveExtractLimits;
|
||||
@@ -570,7 +570,7 @@ export async function extractArchive(params: {
|
||||
await withStagedArchiveDestination({
|
||||
destinationRealDir,
|
||||
run: async (stagingDir) => {
|
||||
const checkTarEntrySafety = createTarEntrySafetyChecker({
|
||||
const checkTarEntrySafety = createTarEntryPreflightChecker({
|
||||
rootDir: destinationRealDir,
|
||||
stripComponents: params.stripComponents,
|
||||
limits,
|
||||
|
||||
Reference in New Issue
Block a user