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 { 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",
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user