Repository navigation
Conversation
1. Root cause: replace("/sys", "") replaced all occurrences of
"/sys" substring in the path, not just the prefix, causing
incorrect path matching when "/sys" appeared mid-path
2. Fix: use startsWith("/sys") to check prefix, then remove(0, 4)
to strip only the leading "/sys" prefix
3. Impact: path matching now correctly strips only the prefix,
no false matches on paths containing "/sys" elsewhere
fix: 精确剥离路径前缀 /sys
1. 根因:replace("/sys", "") 会替换路径中所有 "/sys" 子串,
而非仅剥离前缀,导致路径中间含 "/sys" 时匹配错误
2. 方案:使用 startsWith("/sys") 判断前缀后 remove(0, 4)
精确剥离路径开头的 "/sys" 前缀
3. 影响:路径匹配仅剥离前缀,不再误删路径中间的 "/sys" 子串
PMS: BUG-4
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: add-uos The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideUpdates Flow diagram for precise /sys prefix strippingflowchart TD
A["isPathExisted(path)"] --> B["Copy path to pathT"]
B --> C{"pathT.startsWith(/sys)"}
C -- Yes --> D["pathT.remove(0, 4)"]
C -- No --> E["Keep pathT unchanged"]
D --> F["hwinfo.contains(pathT)"]
E --> F
F --> G["Return exists"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
fix: strip /sys prefix precisely in isPathExisted
"/sys" substring in the path, not just the prefix, causing
incorrect path matching when "/sys" appeared mid-path
to strip only the leading "/sys" prefix
no false matches on paths containing "/sys" elsewhere
fix: 精确剥离路径前缀 /sys
而非仅剥离前缀,导致路径中间含 "/sys" 时匹配错误
精确剥离路径开头的 "/sys" 前缀
PMS: BUG-4
Summary by Sourcery
Bug Fixes: