fix: AppGroup::parseGroupId off-by-one slice error (mid(len+1) → mid(len)) - #1713
fix: AppGroup::parseGroupId off-by-one slice error (mid(len+1) → mid(len))#1713MyLeeJiEun wants to merge 1 commit into
Conversation
…len)) "internal/folder/" is 16 characters (indices 0-15), so the folder number starts at index 16. mid(len + 1) = mid(17) skipped the first digit, causing all non-zero folder IDs to parse incorrectly (e.g. "internal/folder/123" → 23 instead of 123). Folder 0 was incidentally correct because mid(17) yielded an empty string → toInt() = 0. Change mid(len + 1) to mid(len) so slicing starts at the correct position. Closes: DDE-143
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: MyLeeJiEun 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 GuideFixes File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Hi @MyLeeJiEun. Thanks for your PR. I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
修复内容
AppGroup::parseGroupId存在 off-by-one 切片错误:mid(len + 1)应为mid(len)。根因
"internal/folder/"长度为 16 字符(下标 0–15),folder 号从下标 16 开始。mid(len + 1)=mid(17)多跳一位,跳过了 folder 号的首位数字:mid(17)旧(缺陷)mid(16)新(修复)internal/folder/0""→ 0(偶然正确)"0"→ 0 ✅internal/folder/5""→ 0 ❌"5"→ 5 ✅internal/folder/123"23"→ 23 ❌"123"→ 123 ✅变更
仅 1 行改动(
applets/dde-apps/appgroup.cpp:64):调用点
parseGroupId共 2 处调用,均已确认输入为合法"internal/folder/..."形式:appgroup.cpp:23构造函数:groupId 来自groupIdFromNumber()→"internal/folder/N"appgroupmanager.cpp:185拖拽落点:前置AppGroup::idIsFolder(dropId)守卫无回归风险,变更最小且外科手术式。
Closes: DDE-143
Summary by Sourcery
Bug Fixes: