fix: Fix incorrect names when extracting encrypted folders#354
fix: Fix incorrect names when extracting encrypted folders#354pengfeixx merged 1 commit intolinuxdeepin:develop/snipefrom
Conversation
Fix incorrect names when extracting encrypted folders Log: Fix incorrect names when extracting encrypted folders
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdjusts password handling for ZIP compression to always use the libzip plugin when a password is set, and fixes the name shown in password prompts during extraction to avoid incorrect file/folder names, especially for encrypted folders. Sequence diagram for updated ZIP compression plugin selectionsequenceDiagram
participant User
participant MainWindow
participant UiTools
User->>MainWindow: slotCompress(val)
MainWindow->>MainWindow: Check m_stCompressParameter.strMimeType
alt MIME is application/zip and password not empty
MainWindow->>MainWindow: useLibzipForPassword = true
MainWindow->>MainWindow: eType = UiTools.APT_Libzip
else other cases
MainWindow->>MainWindow: Select eType based on options and bUseLibarchive
end
MainWindow->>UiTools: startCompression(eType, m_stCompressParameter)
Sequence diagram for updated password prompt naming during extractionsequenceDiagram
participant User
participant LibzipPlugin
participant PasswordNeededQuery
participant UI
User->>LibzipPlugin: extractFiles(files, options)
alt Extract all files
LibzipPlugin->>PasswordNeededQuery: create with m_strArchiveName
else Extract selected files
alt m_listCurIndex.count() == 1
LibzipPlugin->>PasswordNeededQuery: create with strFileName
else m_listCurIndex.count() > 1
LibzipPlugin->>PasswordNeededQuery: create with m_strArchiveName
end
end
LibzipPlugin->>UI: signalQuery(query)
UI->>User: Show password dialog using display name
User-->>UI: Enter password
UI-->>PasswordNeededQuery: Provide password response
PasswordNeededQuery-->>LibzipPlugin: waitForResponse() returns
LibzipPlugin->>LibzipPlugin: Retry extraction with provided password
Class diagram for updated ZIP password handlingclassDiagram
class MainWindow {
- CompressParameter m_stCompressParameter
- Options options
- bool bUseLibarchive
+ void slotCompress(QVariant val)
}
class CompressParameter {
+ QString strMimeType
+ QString strPassword
}
class Options {
+ bool bSplit
}
class UiTools {
<<enumeration>> AssignPluginType
}
class AssignPluginType {
<<enumeration>>
+ APT_Auto
+ APT_Libzip
}
MainWindow --> CompressParameter
MainWindow --> Options
MainWindow --> UiTools
class LibzipPlugin {
- QString m_strArchiveName
- QList~int~ m_listCurIndex
- ErrorType m_eErrorType
+ PluginFinishType extractFiles(QList~FileEntry~ files, Options options)
}
class ErrorType {
<<enumeration>>
+ ET_WrongPassword
+ ET_NeedPassword
}
class PluginFinishType {
<<enumeration>>
+ PFT_Error
+ PFT_Success
}
class FileEntry {
+ QString strFileName
}
class PasswordNeededQuery {
+ PasswordNeededQuery(QString displayName)
+ void waitForResponse()
}
LibzipPlugin --> FileEntry
LibzipPlugin --> PasswordNeededQuery
LibzipPlugin --> ErrorType
LibzipPlugin --> PluginFinishType
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review这段代码修改主要涉及压缩/解压时的密码处理逻辑和用户提示信息的优化。以下是对这段diff的详细审查意见: 1. 语法与逻辑审查优点:
潜在问题/建议:
2. 代码质量审查
3. 代码性能审查
4. 代码安全审查
总结与改进建议总体评价:这是一次质量较高的重构。它提升了用户体验(更清晰的提示信息)和代码性能(移除不必要的遍历),并简化了逻辑。 具体改进建议:
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The
if (true == useLibzipForPassword)style checks can be simplified toif (useLibzipForPassword)for readability and consistency with typical Qt/C++ code style. - The logic for choosing the display name in password prompts (archive name vs. file name) is now split across two branches in
extractFiles; consider extracting this into a small helper or a single place to avoid subtle divergence in future changes.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `if (true == useLibzipForPassword)` style checks can be simplified to `if (useLibzipForPassword)` for readability and consistency with typical Qt/C++ code style.
- The logic for choosing the display name in password prompts (archive name vs. file name) is now split across two branches in `extractFiles`; consider extracting this into a small helper or a single place to avoid subtle divergence in future changes.
## Individual Comments
### Comment 1
<location> `3rdparty/libzipplugin/libzipplugin.cpp:209-213` </location>
<code_context>
}
- PasswordNeededQuery query(strFileName);
+ // 全部解压时显示压缩包名称
+ PasswordNeededQuery query(m_strArchiveName);
emit signalQuery(&query);
</code_context>
<issue_to_address>
**suggestion:** The display-name selection for password prompts is now duplicated and slightly divergent between the two branches.
One branch now always uses `m_strArchiveName` for the prompt, while the other switches between `strFileName` and `m_strArchiveName` based on `m_listCurIndex.count()`. If these are intended to be the same flow, consider a small helper that derives a single `displayName` from the current file and selection count and reuse it in both places to keep behavior and labels consistent as the logic evolves.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: lzwind, pengfeixx 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 |
Fix incorrect names when extracting encrypted folders
Log: Fix incorrect names when extracting encrypted folders
Summary by Sourcery
Adjust ZIP password handling and password prompt display names during compression and extraction to fix naming issues with encrypted folders.
Bug Fixes: