Skip to content

fix: compare whole path segments when detecting recursive symlinks - #170

Open
xyrolle wants to merge 1 commit into
thecodrr:masterfrom
xyrolle:fix/symlink-prefix-siblings
Open

xyrolle wants to merge 1 commit into
thecodrr:masterfrom
xyrolle:fix/symlink-prefix-siblings

Conversation

@xyrolle

@xyrolle xyrolle commented Oct 22, 2026

Copy link
Copy Markdown

Fixes #169

With withSymlinks({ resolvePaths: false }), isRecursive treated one symlink target as inside another when its path merely started with the other's as a string, so a link to /x/shared-other inside a link to /x/shared was skipped as recursive. It now compares whole path segments (isInside), after normalizing the target, since a custom fs can return / on Windows. This keeps the existing rule that equal, ancestor and descendant targets count as recursive; only siblings whose names share a prefix change.

Test: a symlinks.test.ts case with root/src -> shared and shared/alias -> shared-other, for both sync and withPromise. It fails without the change.

On master (790c182), 19 tests already fail without this change, and the same 19 fail with it. Applied on v6.5.0, all 107 pass. tsc --noEmit, npm run build and Prettier pass on the branch. #162 moves these tests off mock-fs; if it lands first, I'll move this case to its fixtures.

This branch has not been deployed

No deployments
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.

withSymlinks({ resolvePaths: false }) skips a nested link whose target's name starts with the outer target's

1 participant