mirror of
https://github.com/stablyai/orca.git
synced 2026-10-03 00:02:19 +00:00
Fix usage attribution for dotdot-prefixed child paths (#3651)
* fix: attribute dotdot-prefixed usage paths * Add usage attribution boundary tests Co-authored-by: Orca <help@stably.ai> --------- Co-authored-by: Jinwoo-H <jinwoo0825@gmail.com> Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
@@ -428,7 +428,14 @@ function isContainingPath(candidatePath: string, targetPath: string): boolean {
|
||||
const isAbsoluteRelative = useWin32
|
||||
? win32.isAbsolute(relativePath)
|
||||
: posix.isAbsolute(relativePath)
|
||||
return !isAbsoluteRelative && !relativePath.startsWith('..') && relativePath !== '.'
|
||||
const parentPrefix = useWin32 ? `..${win32.sep}` : `..${posix.sep}`
|
||||
// Why: `..name` is a valid child path; only `..` and `../...` escape.
|
||||
return (
|
||||
!isAbsoluteRelative &&
|
||||
relativePath !== '..' &&
|
||||
!relativePath.startsWith(parentPrefix) &&
|
||||
relativePath !== '.'
|
||||
)
|
||||
}
|
||||
|
||||
async function buildWorktreesWithCanonicalPaths(
|
||||
|
||||
Reference in New Issue
Block a user