mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-30 12:15:34 +00:00
refactor: reuse containsPath in file service
This commit is contained in:
parent
c74350dc22
commit
13dc12fe6d
1 changed files with 1 additions and 2 deletions
|
|
@ -11,6 +11,7 @@ import ignore from "ignore"
|
|||
import path from "path"
|
||||
import z from "zod"
|
||||
import { Global } from "../global"
|
||||
import { Instance } from "../project/instance"
|
||||
import { Log } from "../util"
|
||||
import { Protected } from "./protected"
|
||||
import { Ripgrep } from "./ripgrep"
|
||||
|
|
@ -512,7 +513,6 @@ export const layer = Layer.effect(
|
|||
const ctx = yield* InstanceState.context
|
||||
const full = path.join(ctx.directory, file)
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (!Instance.containsPath(full, ctx)) {
|
||||
throw new Error("Access denied: path escapes project directory")
|
||||
}
|
||||
|
|
@ -592,7 +592,6 @@ export const layer = Layer.effect(
|
|||
ignored = ig.ignores.bind(ig)
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
const resolved = dir ? path.join(ctx.directory, dir) : ctx.directory
|
||||
if (!Instance.containsPath(resolved, ctx)) {
|
||||
throw new Error("Access denied: path escapes project directory")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue