-
Notifications
You must be signed in to change notification settings - Fork 37
Fix: [compress] The tip show error when enter error password. #316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: [compress] The tip show error when enter error password. #316
Conversation
-- Fix the issue where entering an incorrect password for an encrypted ZIP archive should prompt "Wrong password, extraction failed." Log: fix issue Bug: https://pms.uniontech.com/bug-view-301765.html
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThe pull request enhances the extractFiles logic in libzipplugin.cpp by inserting explicit checks for an incorrect password entry and returning a dedicated error (PFT_Error) with a corresponding message, instead of falling through to the generic password-prompt flow. Sequence diagram for error handling when wrong password is entered during ZIP extractionsequenceDiagram
participant User
participant LibzipPlugin
participant Archive
User->>LibzipPlugin: Request to extract encrypted ZIP
LibzipPlugin->>Archive: Attempt extraction with password
Archive-->>LibzipPlugin: Return ET_WrongPassword error
alt Password is not empty
LibzipPlugin->>User: Show error "Wrong password, extraction failed."
LibzipPlugin->>Archive: Close archive
LibzipPlugin->>User: Extraction fails (PFT_Error)
else Password is empty or other error
LibzipPlugin->>User: Prompt for password
end
Class diagram for updated error handling in LibzipPluginclassDiagram
class LibzipPlugin {
- m_eErrorType
- m_strPassword
extractFiles(files: QList<FileEntry>, password: QString): PluginFinishType
}
LibzipPlugin : extractFiles() checks for ET_WrongPassword
LibzipPlugin : On wrong password, clears m_strPassword, closes archive, returns PFT_Error
LibzipPlugin : Emits error("Wrong password.") if password is incorrect
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there - I've reviewed your changes - here's some feedback:
- Consider consolidating the duplicated wrong‐password handling into a single helper to reduce code repetition and ensure consistent behavior across both extraction paths.
- Wrap the user‐facing error string "Wrong password." in your translation/localization function to support internationalization.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider consolidating the duplicated wrong‐password handling into a single helper to reduce code repetition and ensure consistent behavior across both extraction paths.
- Wrap the user‐facing error string "Wrong password." in your translation/localization function to support internationalization.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
deepin pr auto review我来对这个diff进行代码审查:
存在的问题:
改进建议:
PluginFinishType LibzipPlugin::handlePasswordError(zip* archive) {
if(ET_WrongPassword == m_eErrorType && !m_strPassword.isEmpty()) {
zip_close(archive);
m_strPassword = "";
emit error(("Wrong password."));
return PFT_Error;
}
return PFT_Normal;
}
// 密码错误,给出错误提示
if(ET_WrongPassword == m_eErrorType && !m_strPassword.isEmpty()) {
这些修改将使代码更加健壮、可维护,并提高代码质量。 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: GongHeng2017, lzwind 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 |
|
/merge |
-- Fix the issue where entering an incorrect password for an encrypted
ZIP archive should prompt "Wrong password, extraction failed."
Log: fix issue
Bug: https://pms.uniontech.com/bug-view-301765.html
Summary by Sourcery
Improve handling of incorrect passwords during ZIP extraction by resetting the password and displaying an explicit error message.
Bug Fixes: