Conversation
…r_content messages
The send side serialized migration results and transfer progress using
space-delimited fields (name + " " + success + " " + reason + ";"), but
both name and reason are translated strings that contain spaces. The
receive side split on " " with a strict size()==3 / size()==4 check,
which discarded every entry, causing the receiver's completion list to
be empty while the sender's was complete.
Replace the space-delimited format with JSON (QJsonDocument) on both
sides so field boundaries are unambiguous regardless of content:
- add_result: sender builds a QJsonArray of {name, success, reason}
objects; receiver parses the array and emits addResult per entry.
- transfer_content: sender builds a single {type, content, progressbar,
estimatedtime} object; receiver parses it (handling both single object
and array) and emits transferContent.
Log: PMS bug 246975
There was a problem hiding this comment.
Sorry @pengfeixx, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: pengfeixx 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 |
|
CLA Assistant Lite bot: Multica Agent seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. |
Reviewer's GuideSwitches the data-transfer IPC protocol for add_result and transfer_content from ad-hoc space-separated strings to structured JSON using QJsonDocument/QJsonArray/QJsonObject on both sender and receiver sides, eliminating parsing failures when fields contain spaces and adding minor robustness for transfer_content handling. Sequence diagram for JSON data-transfer IPC messagessequenceDiagram
participant ResultDisplayWidget
participant TransferringWidget
participant TransferHelper
participant TransferHandle
participant ResultWindow
ResultDisplayWidget->>ResultDisplayWidget: addResult(name, success, reason)
ResultDisplayWidget->>ResultWindow: updateContent(name, reason, success)
ResultDisplayWidget->>TransferHelper: sendMessage(add_result, QJsonDocument(processText))
TransferHelper->>TransferHandle: handleMiscMessage(jsonmsg)
TransferHandle->>TransferHandle: QJsonDocument::fromJson(result)
TransferHandle-->>TransferHelper: addResult(name, success, reason)
TransferringWidget->>TransferHelper: sendMessage(transfer_content, QJsonDocument(obj))
TransferHelper->>TransferHandle: handleMiscMessage(jsonmsg)
TransferHandle->>TransferHandle: QJsonDocument::fromJson(result)
TransferHandle-->>TransferHelper: transferContent(type, content, progressbar, estimatedtime)
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
fix(data-transfer): use JSON serialization for add_result and transfer_content messages
根因
数据传输完成后两端迁移完成列表不一致,接收端列表为空/严重缺失而发送端完整。
发送端以空格作为字段分隔符序列化迁移结果与传输进度(
name + " " + success + " " + reason + ";"),但name与reason均为含空格的翻译文本。接收端按split(" ")严格校验size()==3/size()==4,当字段含空格时拆分结果字段数超限,continue丢弃该条目。全部 11 处addResult的 reason 均含空格,故缺陷 100% 必现。修复方案
将空格分隔的自定义格式替换为 JSON 结构化序列化(
QJsonDocument),两端格式严格同步,字段边界不再依赖内容是否含空格:add_result
resultdisplay.cpp:processText改为QJsonArray,addResult()构造QJsonObject{name, success, reason}追加到数组,transferFinished时以QJsonDocument::Compact序列化发送。transferworker.cpp:QJsonDocument::fromJson解析数组,逐项emit addResult。transfer_content(同模式一并修复)
transferringwidget.cpp:构造QJsonObject{type, content, progressbar, estimatedtime}→ 紧凑 JSON 发送。transferworker.cpp:解析 JSON(兼容单对象与数组),逐项emit transferContent。涉及文件
src/plugins/data-transfer/core/gui/transfer/resultdisplay.hsrc/plugins/data-transfer/core/gui/transfer/resultdisplay.cppsrc/plugins/data-transfer/core/gui/transfer/transferringwidget.cppsrc/plugins/data-transfer/core/utils/transferworker.cpp边界情况
[],接收端安全遍历。transfer_content接收端兼容单对象与数组,增强健壮性。基线
release/v20570cb50b4f7bb810b9483e3277e2e5199add58c5Log: PMS bug 246975
Summary by Sourcery
Use JSON serialization for add-result and transfer-content messages to preserve message fields reliably across data-transfer endpoints.
Bug Fixes:
Enhancements: