refactor: use InstanceState context in File service
This commit is contained in:
parent
5fa1673341
commit
c74350dc22
1 changed files with 2 additions and 1 deletions
|
|
@ -11,7 +11,6 @@ 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"
|
||||
|
|
@ -513,6 +512,7 @@ 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,6 +592,7 @@ 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