Skip to content

Commit f0b0462

Browse files
committed
fix(ui): show correct error on compat mode install failure
When compat install fails on an already-installed package, check operation status first and return actual error instead of stale dependency status message like "Earlier version installed". 兼容模式安装失败时,优先检查操作状态返回真实错误, 而非显示过时的依赖状态信息如"已安装较早的版本"。 Log: 修复兼容模式安装失败显示错误提示的问题 Influence: 兼容模式下安装失败的包现在会显示正确的失败原因,而非误导性的版本信息。
1 parent 4c36fa3 commit f0b0462

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/deb-installer/model/deblistmodel.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,14 @@ QString DebListModel::packageFailedReason(const int idx) const
896896
return tr("Unmatched package architecture"); // 判断是否架构冲突
897897
}
898898

899+
// When the operation has actually failed, the dependency status may be stale
900+
// (e.g. CompatibleIntalled from a prior detection). Return the real error directly.
901+
if (m_packageOperateStatus.contains(md5) &&
902+
m_packageOperateStatus[md5] == Pkg::PackageOperationStatus::Failed) {
903+
qCDebug(appLog) << "Package operation failed, returning worker error string directly";
904+
return workerErrorString(m_packageFailCode[md5], m_packageFailReason[md5]);
905+
}
906+
899907
// need refactor, move to Deb::DebPackage
900908
int status = dependStatus.status;
901909
if (Pkg::CompatibleNotInstalled == status) {

0 commit comments

Comments
 (0)