You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
IsPrefixOf compares segment strings, not directory depth, for paths with leading ".." #226
IsPrefixOf decides containment by comparing normalized path strings segment by segment. That is correct as long as neither path begins with a .. reference — but .. moves up, so a string prefix stops implying containment:
newLocalPath("..").IsPrefixOf(newLocalPath("foo"));// false, though foo is CWD/foo, which is under ..newLocalPath("..").IsPrefixOf(newLocalPath("../.."));// true, though ../.. is above .., not under it
Answering these correctly means modelling how far above the current directory a path starts — the number of leading .. references — and comparing that together with the remaining segments, rather than comparing strings.
This affects AbsolutePath too: /.. survives normalization, so new AbsolutePath("/..") is a constructible value.
Both behaviors predate #223. A closely related case was fixed there: the empty path (the current directory) was reported as a prefix of ../evil.
Activity
rghvgrv commentedon Sep 25, 2026
Provided the fix for this in PR #234
LocalPath.IsPrefixOf: account for leading .. references (ForNeVeR#226)
LocalPath.IsPrefixOf: account for leading .. references (#226)