fix(ui): fix compat mode reinstall failure after auth cancel#416
Conversation
Auth cancel handler set package status to Failed after signalAuthCancel triggered resetInstallStatus, overwriting the cleaned Prepare state. Also, slotReinstall bypassed the compat confirm flow leaving targetRootfs empty, causing installDebs to fall through to apt backend. 授权取消回调在 resetInstallStatus 之后将包状态覆盖为 Failed,且 slotReinstall 绕过确认流程导致 targetRootfs 为空,安装回退到 apt 后端而失败。 Log: 修复兼容模式授权取消后重装失败的问题 PMS: BUG-362603 Influence: 修复后兼容模式下卸载授权取消,点击重新安装按钮能正确走兼容安装流程完成重装。
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
deepin pr auto review你好!我是CodeGeeX。我已仔细审查了你提供的Git Diff。本次代码变更主要涉及Deb包安装器在处理授权取消时的状态重置逻辑,以及为兼容模式重装场景补充缺失的 以下是针对语法逻辑、代码质量、代码性能和代码安全四个维度的详细审查意见及改进建议: 1. 语法与逻辑1.1 授权取消时移除
1.2
1.3
2. 代码质量2.1 魔法值与硬编码
2.2 代码重复
2.3 注释的移除
3. 代码性能
4. 代码安全4.1
4.2 授权绕过风险
综合改进建议代码示例针对 void SingleInstallPage::slotReinstall()
{
// ... 前置代码 ...
tr("Installing in compatibility mode %1").arg(m_pkgNameDescription));
m_tipsLabel->setCustomDPalette(DPalette::TextLively);
m_tipsLabel->setVisible(true);
// Ensure targetRootfs is set when slotReinstall is called directly
// (e.g. after auth cancel via afterGetAutherFalse), bypassing the
// compat confirm flow where setData(targetRootfs) normally happens.
const int firstRow = 0; // 避免魔法值,明确是单包安装的首行
auto idx = m_packagesModel->index(firstRow);
if (idx.isValid()) { // 确保索引有效,防止空模型导致越界
if (idx.data(DebListModel::CompatibleTargetRootfsRole).toString().isEmpty()) {
// kDefaultRootfs 必须是受控的安全路径
m_packagesModel->setData(idx, kDefaultRootfs, AbstractPackageListModel::CompatibleTargetRootfsRole);
}
}
// ... 后置代码 ...
// 开始安装
// 考虑将 slotInstallPackages 重命名为 installPackages,因为它现在有返回值参与逻辑判断
if (!m_packagesModel->slotInstallPackages()) {
Q_EMIT signalBacktoFileChooseWidget();
return;
}
}总结:本次代码变更整体逻辑清晰,修复了授权取消后状态标记不当的问题,并补充了重装时缺失的参数。主要关注点在于确保 UI 对 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: lzwind, 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 |
Auth cancel handler set package status to Failed after signalAuthCancel triggered resetInstallStatus, overwriting the cleaned Prepare state. Also, slotReinstall bypassed the compat confirm flow leaving targetRootfs empty, causing installDebs to fall through to apt backend.
授权取消回调在 resetInstallStatus 之后将包状态覆盖为
Failed,且 slotReinstall 绕过确认流程导致 targetRootfs
为空,安装回退到 apt 后端而失败。
Log: 修复兼容模式授权取消后重装失败的问题
PMS: BUG-362603
Influence: 修复后兼容模式下卸载授权取消,点击重新安装按钮能正确走兼容安装流程完成重装。