Skip to content

Commit 11692ef

Browse files
committed
fix: resolve file paths relative to scan target in fix engine
The fixer was using finding.file (relative path like "mcp.json") directly with readFileSync, which failed. Now resolves against scanResult.target.path to get the absolute path.
1 parent 10dbbb7 commit 11692ef

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/fixer/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { readFileSync, writeFileSync } from "node:fs";
2+
import { resolve } from "node:path";
23
import type { Finding } from "../types.js";
34
import type { ScanResult } from "../scanner/index.js";
45
import { applyTransform } from "./transforms.js";
@@ -85,7 +86,8 @@ export function applyFixes(scanResult: ScanResult): FixResult {
8586
const applied: AppliedFix[] = [];
8687
const skipped: SkippedFix[] = [];
8788

88-
for (const [filePath, findings] of grouped) {
89+
for (const [relPath, findings] of grouped) {
90+
const filePath = resolve(scanResult.target.path, relPath);
8991
let content: string;
9092
try {
9193
content = readFileSync(filePath, "utf-8");

0 commit comments

Comments
 (0)