Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

IsPrefixOf compares segment strings, not directory depth, for paths with leading ".."

Open
#226 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
68/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
csharp

Research direction

Start at the IsPrefixOf entry point and inspect how normalized path segments are compared, then review the related empty-path behavior from #223. Model leading .. depth for relative paths and verify the examples in the issue, including the /.. case for AbsolutePath.

Written by the indexing model from the issue text.

Description

bug help wanted

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:

new LocalPath("..").IsPrefixOf(new LocalPath("foo"));    // false, though foo is CWD/foo, which is under ..
new LocalPath("..").IsPrefixOf(new LocalPath("../.."));  // 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.

Dominant language
C#
Stars
104
Forks
19
Avg merge
13h 42m
Merged PRs (30d)
9

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ForNeVeR/TruePath

All issues in ForNeVeR/TruePath

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.