Repository navigation
localRealpath follows a link target's .. after the links before it - #6
Merged
Merged
Conversation
A symlink target such as `b/..` was collapsed lexically before `b` was looked at, so when `b` was itself a link the walk answered a different path than opening the link reaches. The walk now keeps a target's `..` as a component and applies it to the link-free path walked so far. The folder Tool also lists a compacted folder by the canonical path it checked to be inside its root, rather than handing the kernel the uncanonical one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Deploying dor-tools with
|
| Latest commit: |
d02d0a9
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://7df3fbaa.dor-tools.pages.dev |
| Branch Preview URL: | https://link-target-dotdot.dor-tools.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
localRealpath(@dor-tools/scaffold/server) collapsed a..in a symlink's target lexically before walking it. Fora -> b/..wherebis itself a link, it answereda's directory, while openingagoes to the parent of whereverbleads. The walk now keeps a target's..as a component and applies it, as the filesystem does, to the link-free path walked so far, so the answer is where the kernel goes. A rooted target is walked from its drive's root.The folder Tool's compaction now lists each hop by the canonical path it checked to be inside the root, the same as
existingInsideandkindOfalready do, rather than passing the uncanonical path toopendir.Verified:
scaffold/test/local-path.test.mjs: a Windows-semantics case (relative and rooted targets whose..follows a link) and a real POSIX case comparing against the kernel. Both fail with the walk change reverted.suite/test/folder-viewer.test.mjs: a link whose target's..leaves through another link lists asotherand cannot be listed. Fails with the scaffold change reverted.pnpm testinscaffold(22 pass) andsuite(270 pass).🤖 Generated with Claude Code