Skip to content

Commit 385d501

Browse files
committed
fix: Fix incorrect names when extracting encrypted folders
Fix incorrect names when extracting encrypted folders Log: Fix incorrect names when extracting encrypted folders
1 parent b00add3 commit 385d501

2 files changed

Lines changed: 9 additions & 11 deletions

File tree

3rdparty/libzipplugin/libzipplugin.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,8 @@ PluginFinishType LibzipPlugin::extractFiles(const QList<FileEntry> &files, const
206206
return PFT_Error;
207207
}
208208

209-
PasswordNeededQuery query(strFileName);
209+
// 全部解压时显示压缩包名称
210+
PasswordNeededQuery query(m_strArchiveName);
210211
emit signalQuery(&query);
211212
query.waitForResponse();
212213

@@ -260,7 +261,9 @@ PluginFinishType LibzipPlugin::extractFiles(const QList<FileEntry> &files, const
260261
// 判断是否需要密码,若需要密码,弹出密码输入对话框,用户输入密码之后,重新解压当前文件
261262
if (ET_WrongPassword == m_eErrorType || ET_NeedPassword == m_eErrorType) {
262263

263-
PasswordNeededQuery query(strFileName);
264+
// 根据解压文件数量决定显示的名称:单文件显示文件名,多文件显示压缩包名
265+
QString displayName = (m_listCurIndex.count() == 1) ? strFileName : m_strArchiveName;
266+
PasswordNeededQuery query(displayName);
264267
emit signalQuery(&query);
265268
query.waitForResponse();
266269

src/source/mainwindow.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,20 +1270,15 @@ void MainWindow::slotCompress(const QVariant &val)
12701270
bUseLibarchive = false;
12711271
#endif
12721272

1273-
// 判断zip格式是否使用了中文加密
1274-
bool zipPasswordIsChinese = false;
1273+
bool useLibzipForPassword = false;
12751274
if ("application/zip" == m_stCompressParameter.strMimeType) {
1276-
for (const QChar &ch : m_stCompressParameter.strPassword) {
1277-
if (ch.unicode() >= 0x4E00 && ch.unicode() <= 0x9FA5) {
1278-
zipPasswordIsChinese = true;
1279-
break;
1280-
}
1275+
if (!m_stCompressParameter.strPassword.isEmpty()) {
1276+
useLibzipForPassword = true;
12811277
}
12821278
}
12831279

12841280
UiTools::AssignPluginType eType = UiTools::APT_Auto; // 默认自动选择插件
1285-
if (true == zipPasswordIsChinese) {
1286-
// 对zip的中文加密使用libzip插件
1281+
if (true == useLibzipForPassword) {
12871282
eType = UiTools::APT_Libzip;
12881283
} else if ((false == options.bSplit) && true == bUseLibarchive && "application/zip" == m_stCompressParameter.strMimeType) {
12891284
// 考虑到华为arm平台 zip压缩 性能提升,只针对zip类型的压缩才会考虑到是否特殊处理arm平台,分卷情况不做此处理

0 commit comments

Comments
 (0)