ソースを参照

fix(core): normalize file.status paths relative to instance dir (#14207)

Shantur Rathore 2 ヶ月 前
コミット
190d2957eb
1 ファイル変更7 行追加4 行削除
  1. 7 4
      packages/opencode/src/file/index.ts

+ 7 - 4
packages/opencode/src/file/index.ts

@@ -482,10 +482,13 @@ export namespace File {
       }
     }
 
-    return changedFiles.map((x) => ({
-      ...x,
-      path: path.relative(Instance.directory, x.path),
-    }))
+    return changedFiles.map((x) => {
+      const full = path.isAbsolute(x.path) ? x.path : path.join(Instance.directory, x.path)
+      return {
+        ...x,
+        path: path.relative(Instance.directory, full),
+      }
+    })
   }
 
   export async function read(file: string): Promise<Content> {