Conversation
PMS bug #246975: 数据传输完成后两端迁移完成列表不一致
根因: add_result 与 transfer_content 通道以空格作为字段分隔符,
而 name/reason/filepath 均为含空格的翻译文本或文件路径,导致接收端
按 split(" ") 严格校验字段数时丢弃全部条目,接收端列表为空/缺失,
与发送端完整列表不一致。
修复方案 (方案 A): 改用 QJsonDocument 结构化序列化,两端格式严格同步。
- add_result 发送端 resultdisplay.cpp: 以 QJsonArray 累积结果,
QJsonDocument 序列化后发送,替代 processText 空格拼接
- add_result 接收端 transferworker.cpp: 解析 JSON 数组取字段,
替代 split(";")/split(" ") + size()==3 校验
- transfer_content 发送端 transferringwidget.cpp: 以 QJsonObject
序列化单条进度消息,替代空格拼接
- transfer_content 接收端 transferworker.cpp: 解析 JSON 对象取字段,
替代 split(";")/split(" ") + size()==4 校验
边界情况: 空字段、含空格/特殊字符的 name/reason/filepath、空列表、
异步应用安装结果在发送前已包含等,均由 JSON 转义自动处理。
基线: release/v20 @ 570cb50
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: LiHua000 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 GuideThis PR replaces ad-hoc, space-delimited string protocols for migration result and progress messages with structured JSON serialization on both the GUI sender side and the transfer worker receiver side to fix dropped entries when fields contain spaces or special characters. Sequence diagram for JSON migration result exchangesequenceDiagram
participant ResultDisplayWidget
participant TransferHelper
participant TransferHandle
participant ReceiverUI
ResultDisplayWidget->>ResultDisplayWidget: addResult(name, success, reason)
ResultDisplayWidget->>TransferHelper: sendMessage(add_result, QJsonDocument::toJson(Compact))
TransferHelper->>TransferHandle: add_result JSON array
TransferHandle->>TransferHandle: QJsonDocument::fromJson()
TransferHandle->>ReceiverUI: addResult(name, success, reason)
TransferHandle->>ReceiverUI: transferFinished()
Sequence diagram for JSON transfer progress exchangesequenceDiagram
participant TransferringWidget
participant TransferHelper
participant TransferHandle
participant ReceiverUI
TransferringWidget->>TransferringWidget: updateProcess(type, content, progressbar, estimatedtime)
TransferringWidget->>TransferHelper: sendMessage(transfer_content, QJsonDocument::toJson(Compact))
TransferHelper->>TransferHandle: transfer_content JSON object
TransferHandle->>TransferHandle: QJsonDocument::fromJson()
TransferHandle->>ReceiverUI: transferContent(type, content, progressbar, estimatedtime)
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Author
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.
修复:数据传输完成后两端迁移完成列表不一致 (PMS #246975)
根因
add_result与transfer_content消息以空格作为字段分隔符,而name/reason/filepath均为含空格的翻译文本或文件路径。接收端按split(" ")严格校验字段数(add_result要求 3 个、transfer_content要求 4 个),含空格的值导致字段数不匹配,全部条目被continue丢弃。接收端完成列表为空/严重缺失,与发送端完整列表不一致。全部 11 处addResult的 reason 均含空格,缺陷 100% 必现。修复方案(方案 A:JSON 结构化序列化)
改用
QJsonDocument结构化序列化,两端格式严格同步,JSON 转义自动处理含空格/特殊字符的字段值。add_result 通道:
resultdisplay.cpp:以QJsonArray累积结果项(QJsonObject含name/success/reason),QJsonDocument::toJson(Compact)序列化后发送,替代空格拼接的processTexttransferworker.cpp:解析 JSON 数组,逐项提取字段,替代split(";")/split(" ")+size()==3校验transfer_content 通道(同模式一并修复):
transferringwidget.cpp:以QJsonObject序列化单条进度消息(type/content/progressbar/estimatedtime),替代空格拼接transferworker.cpp:解析 JSON 对象提取字段,替代split(";")/split(" ")+size()==4校验边界情况
空字段、含空格/特殊字符的 name/reason/filepath、空列表、异步应用安装结果在发送前已包含等,均由 JSON 转义自动处理。
基线
release/v20570cb50b4f7bb810b9483e3277e2e5199add58c5Summary by Sourcery
使用 JSON 结构化消息传输迁移结果和进度信息,确保包含空格及特殊字符的字段能够在两端正确同步。
Bug Fixes:
Enhancements: