Skip to content

fix: prompt wrong password on single file extract - #488

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:release/eaglefrom
LiHua000:agent/pms-bug-bot/679e5b83d59b
Sep 14, 2026
Merged

deepin-bot[bot] merged 1 commit into
linuxdeepin:release/eaglefrom
LiHua000:agent/pms-bug-bot/679e5b83d59b

Conversation

@LiHua000

@LiHua000 LiHua000 commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor
  1. Root cause: handleJobErrorFinished() single-extract branch switch only handled ET_LongNameError and ET_MissingVolume, ET_WrongPassword fell into default:break and was silently swallowed
  2. Fix: add ET_WrongPassword case to show floating message, matching the disabled #if 0 block and JT_Add branch behavior
  3. Impact: only affects encrypted archive single-file extract with wrong password, no change to other error paths or operations

Log: Show wrong password prompt on encrypted archive single file extract

Influence:

  1. Test single file extract from encrypted archive with wrong password
  2. Test single file extract from encrypted archive with correct password
  3. Test batch extract from encrypted archive with wrong password

fix: 修复加密压缩包单文件提取时密码错误无提示

  1. 根因:handleJobErrorFinished() 单文件提取分支的 switch 仅处理 ET_LongNameError 和 ET_MissingVolume,ET_WrongPassword 落入 default:break 被静默吞掉
  2. 方案:在 switch 中新增 ET_WrongPassword case,弹出浮层提示, 与被 #if 0 禁用的逻辑及 JT_Add 分支处理方式一致
  3. 影响:仅影响加密压缩包单文件提取输入错误密码的场景,不影响 其他错误类型和其他操作路径

Log: 加密压缩包右键单文件提取输入错误密码时提示密码错误

Influence:

  1. 测试加密压缩包右键单个文件提取输入错误密码
  2. 测试加密压缩包右键单个文件提取输入正确密码
  3. 测试加密压缩包批量解压输入错误密码

PMS: BUG-376693

Summary by Sourcery

Bug Fixes:

  • Show a wrong-password notification when single-file extraction from an encrypted archive fails due to invalid credentials.

1. Root cause: handleJobErrorFinished() single-extract branch switch
   only handled ET_LongNameError and ET_MissingVolume, ET_WrongPassword
   fell into default:break and was silently swallowed
2. Fix: add ET_WrongPassword case to show floating message, matching
   the disabled #if 0 block and JT_Add branch behavior
3. Impact: only affects encrypted archive single-file extract with
   wrong password, no change to other error paths or operations

Log: Show wrong password prompt on encrypted archive single file extract

Influence:
1. Test single file extract from encrypted archive with wrong password
2. Test single file extract from encrypted archive with correct password
3. Test batch extract from encrypted archive with wrong password

fix: 修复加密压缩包单文件提取时密码错误无提示

1. 根因:handleJobErrorFinished() 单文件提取分支的 switch 仅处理
   ET_LongNameError 和 ET_MissingVolume,ET_WrongPassword 落入
   default:break 被静默吞掉
2. 方案:在 switch 中新增 ET_WrongPassword case,弹出浮层提示,
   与被 #if 0 禁用的逻辑及 JT_Add 分支处理方式一致
3. 影响:仅影响加密压缩包单文件提取输入错误密码的场景,不影响
   其他错误类型和其他操作路径

Log: 加密压缩包右键单文件提取输入错误密码时提示密码错误

Influence:
1. 测试加密压缩包右键单个文件提取输入错误密码
2. 测试加密压缩包右键单个文件提取输入正确密码
3. 测试加密压缩包批量解压输入错误密码

PMS: BUG-376693
@sourcery-ai

sourcery-ai Bot commented Sep 14, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds explicit ET_WrongPassword handling to the single-file extraction error path so encrypted archives with an incorrect password display a floating “Wrong password” message instead of silently ignoring the error; other error paths and extraction modes remain unchanged.

Sequence diagram for single-file extraction wrong-password handling

sequenceDiagram
    participant User
    participant MainWindow
    participant CustomFloatingMessage

    User->>MainWindow: Extract single file
    MainWindow->>MainWindow: handleJobErrorFinished(JT_Add, ET_WrongPassword)
    MainWindow->>CustomFloatingMessage: CustomFloatingMessage(icon, Wrong password, 1000, this)
    MainWindow->>CustomFloatingMessage: sendMessage(...)
    CustomFloatingMessage-->>User: Display Wrong password
Loading

File-Level Changes

Change Details Files
Restore wrong-password feedback for single-file extraction failures.
  • Add an ET_WrongPassword branch to the single-extract error switch.
  • Display a one-second “Wrong password” floating message, consistent with existing password-error handling.
src/source/mainwindow.cpp
Preserve behavior across unaffected extraction paths.
  • Leave existing long-name, missing-volume, and default error handling unchanged.
  • Limit the fix to single-file extraction while retaining batch extraction behavior.
src/source/mainwindow.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@LiHua000

Copy link
Copy Markdown
Contributor Author

/merge

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: LiHua000, max-lvs

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deepin-bot

deepin-bot Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

This pr cannot be merged! (status: unstable)

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 98 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 总体评分 98 分,大于 70 分通过阈值,代码质量符合要求。本次修改在 handleJobErrorFinished() 函数的单文件提取分支中新增 ET_WrongPassword 错误处理,修复了加密压缩包单文件提取时密码错误无提示的问题,代码实现与 JT_Add 分支及被 #if 0 禁用的逻辑保持一致,无安全漏洞。

🔍 详细分析

1. 语法逻辑 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: 语法正确,逻辑清晰。新增的 case ET_WrongPassword 分支语法正确,break 语句完整,花括号包裹规范。icon 变量在 switch 之前已初始化(第1760行),this 指针有效,无空指针风险。CustomFloatingMessage 通过 new 创建并传入 this 作为 parent,由 Qt 父子机制管理生命周期,无内存泄漏。逻辑正确:将原本落入 default:break 被静默吞掉的 ET_WrongPassword 错误改为弹出浮层提示,与 JT_Add 分支(第1707-1709行)处理方式一致。


2. 代码质量 ✅

评价: 优秀 ✅ 通过

潜在问题:

  1. src/source/mainwindow.cpp:1777 - 新增 ET_WrongPassword case 缺少注释,建议添加 // 密码错误 注释与 JT_Add 分支保持一致

建议: 建议在新增的 case ET_WrongPassword 上方添加 // 密码错误 注释,与 JT_Add 分支保持一致。其余代码结构清晰,遵循现有模式,无重复代码引入。


3. 代码性能 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: 性能良好,资源使用合理。新增代码仅调用 sendMessage 显示浮层提示,无性能开销。CustomFloatingMessage 由 Qt 父子机制管理,无资源泄漏风险。


4. 代码安全 🔒

评价: 优秀 ✅ 通过

🔐 发现 0 个安全漏洞

安全漏洞详情:
✅ 未发现安全漏洞

建议: 存在0个安全漏洞。tr("Wrong password") 为静态可翻译字符串,无注入风险。无用户输入直接用于危险操作,无敏感信息泄露。


💡 改进建议代码示例

// 建议在 case 上方添加注释,与 JT_Add 分支保持一致
// 密码错误
case ET_WrongPassword: {
    sendMessage(new CustomFloatingMessage(icon, tr("Wrong password"), 1000, this));
    break;
}

本报告由 AI 代码审查工具自动生成

@LiHua000

Copy link
Copy Markdown
Contributor Author

/merge

@deepin-bot
deepin-bot Bot merged commit b416a9f into linuxdeepin:release/eagle Sep 14, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants