fix: check POSIX absolute path before Win32 in resolveSymlinks#75
Open
laplaque wants to merge 1 commit intojacksteamdev:mainfrom
Open
fix: check POSIX absolute path before Win32 in resolveSymlinks#75laplaque wants to merge 1 commit intojacksteamdev:mainfrom
laplaque wants to merge 1 commit intojacksteamdev:mainfrom
Conversation
path.win32.isAbsolute() returns true for POSIX absolute paths (a leading "/" is treated as the current drive root), so checking it first causes the root segment to be set to "" instead of "/". This produces a relative path, and realpath then resolves it against CWD — prepending the home directory on every iteration. Swapping the if/else-if order so path.posix.isAbsolute() is checked first fixes the duplicate path issue on Linux/macOS/WSL. Fixes jacksteamdev#36
✅ Deploy Preview for superb-starlight-b5acb5 canceled.
|
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.
Summary
Fixes #36 — duplicate
/home/<user>in server install path on Linux/macOS/WSL.Root cause:
path.win32.isAbsolute()returnstruefor POSIX absolute paths (a leading/is treated as the current drive root in Win32). Since it was checked first in theif/else-ifchain,path.posix.isAbsolute()was never reached on non-Windows platforms. This caused the root segment to be set to""instead of"/", producing a relative path.realpaththen resolved it against CWD, prepending the home directory on every path component — and compounding with each settings panel open or install attempt.Fix: Swap the
if/else-iforder sopath.posix.isAbsolute()is checked first. This is a one-line logic change (plus explanatory comments) with no behavioral impact on Windows, wherepath.posix.isAbsolute()returnsfalsefor drive-letter paths likeC:\....Note on existing PRs
PRs #45 and #52 address the same issue with a post-hoc
removeDuplicatePathSegments()function. This PR instead fixes the root cause directly, avoiding the need for path deduplication heuristics.Test plan
/home/user/vault