fix: handle password prompt and missing list in long filename extraction #413
Merged
deepin-bot[bot] merged 3 commits intoMay 19, 2026
Merged
Conversation
Log: as title
remove connect of libarchive Log: fix bug Bug: https://pms.uniontech.com/bug-view-360229.html
- Add password detection in handleLongNameExtract() for content-encrypted archives to prevent UI freeze - Remove FILE_MAX_SIZE check so right-click extract always lists first, ensuring long filename prescan has archive data available Log: fix bug Bug:https://pms.uniontech.com//bug-view-361845.html
deepin pr auto review你好!我是CodeGeeX。我已仔细审查了你提供的Git Diff代码。本次修改主要涉及: 以下是针对语法逻辑、代码质量、代码性能和代码安全四个方面的详细审查意见和改进建议: 1. 语法与逻辑
2. 代码质量
3. 代码性能
4. 代码安全
💡 综合改进建议代码示例针对 // 建议在类定义中增加常量
static const int PROCESS_POLL_TIMEOUT_MS = 200;
static const int PROCESS_KILL_TIMEOUT_MS = 3000;
bool CliInterface::handleLongNameExtract(const QList<FileEntry> &files)
{
// ... 前置代码 ...
pProcess->setProgram(m_cliProps->property("extractProgram").toString(),
m_cliProps->extractArgs(absoluteDestinationPath, fileList, false, password));
pProcess->start();
// 检测加密文件解压时的密码提示,避免进程卡死
if (password.isEmpty()) {
QByteArray buffer;
bool needPassword = false;
while (!pProcess->waitForFinished(PROCESS_POLL_TIMEOUT_MS)) {
// 追加读取数据到缓冲区
buffer.append(pProcess->readAllStandardOutput());
// 按行处理缓冲区
while (buffer.contains('\n')) {
int idx = buffer.indexOf('\n');
QString line = QString::fromLocal8Bit(buffer.left(idx));
buffer.remove(0, idx + 1);
if (isPasswordPrompt(line)) {
needPassword = true;
break;
}
}
if (needPassword) {
break;
}
}
if (needPassword) {
// 优先尝试优雅退出,避免临时文件损坏
pProcess->terminate();
if (!pProcess->waitForFinished(PROCESS_KILL_TIMEOUT_MS)) {
pProcess->kill();
pProcess->waitForFinished(PROCESS_KILL_TIMEOUT_MS);
}
PasswordNeededQuery query(m_strArchiveName);
emit signalQuery(&query);
query.waitForResponse();
if (query.responseCancelled()) {
m_eErrorType = ET_NeedPassword;
// TODO: 建议在此处添加清理解压临时文件的逻辑
return false;
}
password = query.password();
DataManager::get_instance().archiveData().strPassword = password;
// 重新启动解压进程
pProcess->setPtyChannels(KPtyProcess::StdinChannel);
pProcess->setOutputChannelMode(KProcess::MergedChannels);
pProcess->setNextOpenMode(QIODevice::ReadWrite | QIODevice::Unbuffered | QIODevice::Text);
pProcess->setProgram(m_cliProps->property("extractProgram").toString(),
m_cliProps->extractArgs(absoluteDestinationPath, fileList, false, password));
pProcess->start();
pProcess->waitForFinished(-1);
}
} else {
pProcess->waitForFinished(-1);
}
// ... 后置代码 ...
}最后提醒:关于 |
lzwind
approved these changes
May 19, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: LiHua000, 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 |
Contributor
Author
|
/merge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
3 commit:
1.fix: handle password prompt and missing list in long filename extraction
2.fix: incorrect passing and display of third-party library signals.
3.chore: update gitignore
bug:
https://pms.uniontech.com/bug-view-360229.html
https://pms.uniontech.com//bug-view-361845.html