Repository navigation
fix: ask for the password again after a wrong password - #547
liuwenhuan wants to merge 2 commits into
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
Reviewer's GuideData structuresAdd a reset operation to the archive interface and its CLI implementation so each new job clears stale error and finish results.
APIExpose retry handling for wrong-password job failures and retain the unanswered-prompt state and chosen extraction destination needed by that behavior.
Uses of the APIReset reused archive-interface results once when each single or update job starts, preserving errors that arise later within that job.
ImplementationRelease a failed CLI process and add password-query state that can carry a wrong-password hint to the next prompt.
Retry the same load or extraction after a wrong password, prevent repeated retries when no prompt was shown, preserve the chosen destination, and restore the open archive list on Back.
UIShow a translated wrong-password hint and mark the password field until the user edits it.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2d82f2453e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| QTimer::singleShot(0, this, [this, strPath]() { | ||
| slotUncompressClicked(strPath); |
There was a problem hiding this comment.
Avoid adding the archive folder again on password retry
With automatic folder creation enabled (the default), m_stUnCompressParameter.strExtractPath already includes the archive-named folder added by slotUncompressClicked(). Passing that effective destination back into the same slot appends the folder again: extracting a.zip to /dest after one wrong password writes to /dest/a/a instead of /dest/a, and each subsequent wrong password adds another level. This can also separate files extracted before the password failure from those extracted afterward. Preserve the original base destination or restart with the saved extraction options rather than reapplying destination construction.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Agreed. The retry now uses the destination the user chose (m_strUncompressBasePath, saved at the start of slotUncompressClicked()) instead of m_stUnCompressParameter.strExtractPath, so the archive-named folder is added once.
| QTimer::singleShot(0, this, [this, eType, strArchive]() { | ||
| rightExtract2Path(eType, QStringList() << strArchive); |
There was a problem hiding this comment.
Release the failed listing process before restarting extraction
For a file-manager extraction that first runs the preliminary tmpList process, such as a header-encrypted 7z/RAR on a non-LNFS target, a wrong password leaves m_process allocated: the nonzero-exit branch in CliInterface::runProcess() emits failure without calling deleteProcess(). This retry reuses that interface through ArchiveManager::extractFiles(), so the next runProcess() trips Q_ASSERT(!m_process) in assertion-enabled builds; release builds overwrite and leak the process pointer instead. Clean up the failed preliminary process or recreate the interface before restarting.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Agreed. When the preliminary tmpList listing fails, the finished handler now calls deleteProcess() before reporting PFT_Error, so the retry starts with no process left on the interface (no Q_ASSERT(!m_process) failure, no leak).
1. ArchiveManager reuses the plugin interface for later operations on the same archive. The finish type and the error type of a failed operation stayed on the interface, so the next operation could end with the old error: after a wrong password, extracting again with the right password reported "The archive is damaged". 2. ReadOnlyArchiveInterface::resetResult() clears the error type; CliInterface also clears the finish type. SingleJob::start() and UpdateJob::start() call it, once per job, so an error found earlier in the same job (for example ET_LongNameError before the long-name extraction refreshes the list) is kept. Log: Forget the result of the previous operation when a new one starts. Influence: 1. Extract an encrypted archive with a wrong password, then with the right one: the second extraction succeeds. 2. Extracting a file with a long name still reports the long-name case. fix: 任务开始时重置复用插件的结果 1. ArchiveManager 对同一压缩包的后续操作复用插件对象。失败操作的结束类型 和错误类型留在插件对象上,下一次操作可能带着旧错误结束:输错密码后再用 正确密码解压,提示"压缩包已损坏"。 2. ReadOnlyArchiveInterface::resetResult() 清除错误类型,CliInterface 还 清除结束类型。SingleJob::start() 和 UpdateJob::start() 每个任务调用一 次,因此同一任务中较早发现的错误(如长文件名解压刷新列表前设置的 ET_LongNameError)得以保留。 Log: 新操作开始时清除上一次操作的结果。 Influence: 1. 加密压缩包先输错密码再输对密码解压:第二次解压成功。 2. 解压长文件名文件仍按长文件名情况处理。
1. A wrong password ended an extraction or load on the failure page. Started from the file manager (extract here / extract to) its Retry button was disabled, and Back cleared the window to an empty home page, also when the archive had been opened in the window. 2. Now a wrong password restarts the same extraction (same destination the user chose, same file-manager mode) or load, and the password dialog asks again with "Wrong password" (the existing, translated MainWindow string) and the field marked until the user types. Cancel behaves as before. Batch extraction keeps the failure page, and so does a retry that ends without showing the dialog, so it cannot loop. 3. Back on the extraction failure page returns to the file list of an archive opened in the window. 4. When the preliminary listing of "Extract here" fails, the plugin releases its process, so the retry can start a new one. 5. The retry needs "fix: reset a reused plugin's result when a job starts": without it the extraction after the right password ends with the previous run's error. Log: Ask for the password again after a wrong password instead of failing. Influence: 1. RAR (data or headers encrypted), 7z and zip: enter a wrong password, then the right one, from "Extract here" and from the window. 2. Cancel the second password dialog. 3. A failed extraction of an opened archive, then Back. fix: 密码错误后重新询问密码 1. 输错密码后解压或加载直接进入失败页面。从文件管理器"解压到当前文件夹" 启动时重试按钮不可用,返回按钮会清空窗口回到空白首页,在窗口中打开的 压缩包也一样。 2. 现在输错密码会以相同方式(用户选择的同一目标位置)重新解压或加载,密码框再次弹出并提示"密码错误" (复用已翻译的 MainWindow 字符串),输入框标红直到重新输入。取消的行为 不变。批量解压仍显示失败页;重试后未弹出密码框即结束时也显示失败页, 不会循环。 3. 在窗口中打开的压缩包解压失败后,返回按钮回到文件列表。 4. "解压到当前文件夹"的预先列出失败时,插件释放其进程,重试才能启动新进程。 5. 重试依赖"fix: 任务开始时重置复用插件的结果":否则输对密码后的解压仍以上 一次的错误结束。 Log: 输错密码后重新询问密码,而不是直接失败。 Influence: 1. RAR(加密数据或文件头)、7z、zip:先输错再输对,分别从"解压到当前 文件夹"和窗口中解压。 2. 第二次密码框点取消。 3. 在窗口中打开的压缩包解压失败后点返回。
2d82f24 to
1b5fa90
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: liuwenhuan 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 |
A wrong password ends an extraction or load on the failure page, with "Wrong password, please retry". The retry options are poor:
This PR:
MainWindowstring, so no new string is added.The first commit, "fix: reset a reused plugin's result when a job starts", is shared with #549, so either PR can be merged alone.
ArchiveManagerreuses the interface for later operations on the same archive, and the finish type and error type of a failed operation stayed on it: after a wrong password, an extraction that succeeded still ended asPFT_Error, and the window showed "The archive is damaged" (the existing Retry path has the same problem).ReadOnlyArchiveInterface::resetResult()/CliInterface::resetResult()clear them once per job, fromSingleJob::start()andUpdateJob::start(); an error found earlier in the same job, such asET_LongNameErrorbefore the long-name extraction refreshes the list, is kept.Tested on deepin-compressor 6.5.32.3 (Qt 6.8, unrar 7.1.8, 7zip 25.01) with this change backported:
-hp), 7z, and zip.-hpRAR (wrong, then right password), extraction in the window to the chosen folder (wrong, then right: no extra folder level), a 7z entry with a 300-byte name (success page still says the name was shortened), and a damaged-hpRAR ("The archive is damaged").This PR compiles on master (6.5.40, Qt 6.8.2). It was not run on master.
输错密码后,解压或加载直接进入失败页。从文件管理器启动时"重试"不可用,"返回"会回到空白首页。本 PR 改为以同样方式重新解压或加载,密码框再次弹出并提示"密码错误"。在窗口中打开的压缩包解压失败后,"返回"会回到文件列表。第一个提交(与 #549 共用)在每个任务开始时重置复用插件对象的结果:以前输错密码后再次解压成功,仍会提示"压缩包已损坏"。
Summary by Sourcery
Retry password-protected archive operations in place after incorrect credentials while preserving the correct archive state and navigation behavior.
New Features:
Bug Fixes: