mirror of
https://github.com/morluto/rea.git
synced 2026-11-03 21:36:13 +00:00
fix(artifacts): preserve selected ASAR companion paths
This commit is contained in:
1 parent
e891926534
commit
779d548c4e
19 files changed
+643
-38
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import type { AnalysisSettingValues } from "../../domain/analysisSettings.js";
|
||||
import { absoluteCallerPath } from "../../filesystem/callerPath.js";
|
||||
import {
|
||||
DEFAULT_ASAR_HEADER_ADMISSION,
|
||||
type AsarHeaderAdmission,
|
||||
@@ -103,20 +104,31 @@ export const reconstructJavaScriptArtifact = async (
|
||||
await checkpointJavaScriptAnalysis(signal);
|
||||
};
|
||||
abortIfNeeded(signal);
|
||||
const { path, metadata } = await resolveSelectedInput(input.input_path);
|
||||
const format = resolveFormat(path, metadata, input);
|
||||
const snapshot = await scanCanonicalArtifactInventoryInScope(path, {
|
||||
resourceScope: scope,
|
||||
signal,
|
||||
integrity: { mode: input.integrity_policy },
|
||||
asarHeaderAdmission,
|
||||
});
|
||||
const selectedPath = absoluteCallerPath(input.input_path);
|
||||
const { path, metadata } = await resolveSelectedInput(selectedPath);
|
||||
const format = resolveFormat(path, metadata, input, selectedPath);
|
||||
const snapshot = await scanCanonicalArtifactInventoryInScope(
|
||||
path,
|
||||
{
|
||||
resourceScope: scope,
|
||||
signal,
|
||||
integrity: { mode: input.integrity_policy },
|
||||
asarHeaderAdmission,
|
||||
},
|
||||
undefined,
|
||||
selectedPath,
|
||||
);
|
||||
if (snapshot.manifest.root_format !== format)
|
||||
throw new ArtifactReaderFailure(
|
||||
"format",
|
||||
`Artifact inventory classified ${path} as ${snapshot.manifest.root_format}, not ${format}`,
|
||||
);
|
||||
const reader = createReader(path, format, asarHeaderAdmission);
|
||||
const reader = createReader(
|
||||
path,
|
||||
format,
|
||||
asarHeaderAdmission,
|
||||
selectedPath,
|
||||
);
|
||||
const readerOwner = {
|
||||
kind: "reader" as const,
|
||||
reader,
|
||||
@@ -483,10 +495,13 @@ const resolveFormat = (
|
||||
path: string,
|
||||
metadata: Stats,
|
||||
input: AnalyzeJavaScriptApplicationInput,
|
||||
selectedPath: string,
|
||||
): "asar" | "directory" => {
|
||||
const observed = metadata.isDirectory()
|
||||
? "directory"
|
||||
: metadata.isFile() && path.toLowerCase().endsWith(".asar")
|
||||
: metadata.isFile() &&
|
||||
(selectedPath.toLowerCase().endsWith(".asar") ||
|
||||
path.toLowerCase().endsWith(".asar"))
|
||||
? "asar"
|
||||
: undefined;
|
||||
if (observed === undefined)
|
||||
|
||||
Reference in new issue
Block a user