Skip to content

Fixes constructing invalid absolute paths. - #233

Merged
ForNeVeR merged 10 commits into
ForNeVeR:mainfrom
sinthu-14:feature/95.forbid-construction-of-incorrect-absolute-paths
Oct 4, 2026
Merged

ForNeVeR merged 10 commits into
ForNeVeR:mainfrom
sinthu-14:feature/95.forbid-construction-of-incorrect-absolute-paths

Conversation

@sinthu-14

@sinthu-14 sinthu-14 commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Closes #95

An exception is thrown now, if the passed string matches the dot-dot directory directly after root (e.g. C:/../ or /../).

@sinthu-14
sinthu-14 marked this pull request as ready for review September 25, 2026 12:14
@ForNeVeR
ForNeVeR self-requested a review September 25, 2026 19:58
@ForNeVeR ForNeVeR self-assigned this Sep 25, 2026
@ForNeVeR
ForNeVeR force-pushed the feature/95.forbid-construction-of-incorrect-absolute-paths branch from 2201c55 to 8d35cf3 Compare October 4, 2026 20:45
…s, Parent gating, docs

- AbsolutePathTests: resolve against a fresh temporary subdirectory, so the
  cross-drive test doesn't depend on TEMP having a parent.
- AbsolutePathTests: fold the duplicated Unix/Windows constructor theories
  into cross-platform ones built on the synthetic root.
- LocalPath.Parent: only check for a trailing ".." in relative paths, since
  the normalization drops a ".." directly after the root.
- Update the normalization docs and the stale comment in PathStrings.
…per-segment allocations

- Return the rented buffer when the path normalizes to an empty path or a
  bare drive, too; previously, these early exits skipped it.
- Compare ".." followed by a separator against preallocated strings instead
  of interpolating them for every segment.
- Remove a no-op Slice call.
@ForNeVeR

ForNeVeR commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

After some thoughts, I decided to change my decision and normalize /.. as /. You'll still be credited in the changelog for help on this one!

@ForNeVeR
ForNeVeR merged commit e5b35d0 into ForNeVeR:main Oct 4, 2026
10 checks passed

This branch was successfully deployed

1 active deployment
github-pages — e5b35d08 Deployed Oct 4, 2026 by ForNeVeR via publish-docs #163
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Forbid construction of incorrect absolute paths

2 participants