fix: show wrong password hint on RAR5 retry dialog - #471
Conversation
There was a problem hiding this comment.
Sorry @Johnson-zs, 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: Johnson-zs 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 guide (collapsed on small PRs)Reviewer's GuideAdds an explicit wrong-password indicator to the CLI archive password handling flow and wires it into the RAR5 retry dialog so the user sees a clear wrong-password hint instead of a generic encrypted-file prompt, while preserving existing behavior for other formats and prior bug fixes. Sequence diagram for the RAR5 wrong-password retry promptsequenceDiagram
participant Unrar
participant CliInterface
participant PasswordNeededQuery
participant User
Unrar->>CliInterface: handleLine(password prompt)
CliInterface->>CliInterface: handlePassword()
CliInterface->>CliInterface: capture m_eErrorType == ET_WrongPassword
CliInterface->>PasswordNeededQuery: PasswordNeededQuery(name, nullptr, isWrongPassword)
PasswordNeededQuery->>User: show Wrong password, please re-enter
User-->>PasswordNeededQuery: enter password
PasswordNeededQuery-->>CliInterface: query response
CliInterface-->>Unrar: retry with password
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
RAR5 archives do not terminate the process on wrong password — unrar emits an error then re-prompts for the password. The re-prompted dialog reused the generic "Encrypted file, please enter the password" text, making it indistinguishable from a first-time prompt (PMS BUG-266113). Root cause: in clirarplugin.cpp, the isPasswordPrompt branch overwrites m_eErrorType to ET_NeedPassword *before* calling handlePassword(), so capturing m_eErrorType inside handlePassword() always yields false. Fix (Approach A): add a member variable m_bWrongPasswordRetry that is set to true in the isWrongPasswordMsg RAR5 branch (before m_eErrorType is overwritten) and checked + reset at the handlePassword() entry. Pass the flag to PasswordNeededQuery to select the "Wrong password, please re-enter" text on retry. Also: - Correct the misleading comment at handlePassword() entry (m01) - Sync .ts translation files via lupdate, add zh_CN translation (m02) Backward compatible: the new PasswordNeededQuery parameter has a default value of false; ET_MissingVolume exemption logic (BUG-373669) unchanged. Log: BUG-266113
c2a3142 to
ed15888
Compare
修复 RAR5 错误密码重弹提示文案错误(PMS BUG-266113)
问题
RAR5 解压输入错误密码后,unrar 不终止进程而是再次弹出密码框,该密码框复用首次提示文案「此文件已加密,请输入解压密码」,未区分「密码错误重试」与「首次输入」,导致用户误以为文件未加密而非密码错误。
上一轮 Review 失败原因(C01)
上一轮在
handlePassword()入口捕获m_eErrorType == ET_WrongPassword,但 RAR5 重入流程中调用方clirarplugin.cpp:277在调用handlePassword()之前已将m_eErrorType覆盖为ET_NeedPassword,导致捕获恒为false,修复完全无效。修复方案(Approach A — 成员变量)
新增成员变量
m_bWrongPasswordRetry,在isWrongPasswordMsg的 RAR5 分支中(m_eErrorType被覆盖前)设置为true,在handlePassword()入口检查并重置。标记在m_eErrorType被覆盖前已持久化,不会丢失。RAR5 错误密码完整时序(修复后):
isWrongPasswordMsg匹配 →m_eErrorType = ET_WrongPassword→m_bWrongPasswordRetry = true→emit error + return true(进程未终止)isPasswordPrompt匹配 →m_eErrorType = ET_NeedPassword(覆盖)→handlePassword()handlePassword()→isWrongPassword = m_bWrongPasswordRetry→true✓ →m_bWrongPasswordRetry = false(重置)PasswordNeededQuery(name, nullptr, true)→ 显示「密码错误,请重新输入」✓变更文件
archiveinterface.hm_bWrongPasswordRetry成员变量clirarplugin.cppm_bWrongPasswordRetry = truecliinterface.cpphandlePassword()入口检查并重置标记,传递给PasswordNeededQuery;更正注释(m01)queries.hPasswordNeededQuery构造函数新增isWrongPassword参数(= false默认值)queries.cppexecute()根据标记选择「密码错误」或「此文件已加密」文案translations/*.tslupdate同步翻译文件,新增 zh_CN 翻译(m02)安全性
PasswordNeededQuery新增参数有= false默认值,所有现有调用方(cliunarchiverplugin、libzipplugin、ut_queries.cpp)仅传第 1 参数,无影响m_eErrorType != ET_MissingVolume条件未改动,BUG-373669 修复保持完整return false终止进程,不重入handlePassword(),新标记对它们无副作用handlePassword()入口立即重置,不会跨次泄漏建议项处理
cliinterface.cpp注释,准确描述捕获机制(成员变量而非 m_eErrorType)lupdate同步所有.ts翻译文件,填充 zh_CN 翻译「密码错误,请重新输入」关联
6a7a7c9665b098275c0d75d1224621afb76d6908(release/eagle)review-471-wrong-password-hint.md