Fix permission persistence failure due to Windows path case-sensitivity#69
Open
BingqingLyu wants to merge 7 commits into
Open
Fix permission persistence failure due to Windows path case-sensitivity#69BingqingLyu wants to merge 7 commits into
BingqingLyu wants to merge 7 commits into
Conversation
Owner
Author
Conflict Group 1This PR shares modified functions with 1 other PR(s): #8. These PRs should be reviewed as a batch — merging one may affect the others.
graph LR
PR69["PR #69"]
FloadSettings_2596["loadSettings<br>settings.ts"]
PR69 -->|modifies| FloadSettings_2596
PR8["PR #8"]
PR8 -->|modifies| FloadSettings_2596
Posted by codegraph-ai conflict detection. |
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.
TL;DR
This PR fixes a bug on Windows 11 where permission options:
were not persisting between sessions.
Root cause:
Case-sensitive path comparisons on Windows (which is a case-insensitive file system).
process.cwd()andfs.realpathSync()can return paths with different casing (e.g.,C:\Users\Aditya\MyProjectvsC:\Users\Aditya\myproject), causing workspace settings to fail loading.Changes
packages/cli/src/config/settings.ts→ Case-insensitive comparison for workspace vs home directory check
packages/core/src/utils/fileUtils.ts→ Case-insensitive
isWithinRoot()function for Windowspackages/cli/src/config/trustedFolders.ts→ Case-insensitive
isPathTrusted()function for WindowsFixes
Closes QwenLM#2669
Dive Deeper
Windows file systems are case-insensitive but case-preserving.
Node.js
fs.realpathSync()may return paths with different casing thanprocess.cwd(), even if they point to the same directory.The original code used strict equality (
===) for path comparison, which caused:Fix:
Normalize paths to lowercase on Windows before comparison to align with OS behavior.