From a78328e2af3c952f725f561cc8419b241fd45089 Mon Sep 17 00:00:00 2001 From: gongheng Date: Thu, 20 Nov 2025 10:19:16 +0800 Subject: [PATCH] Fix: [compress] The tip show error when enter error password. -- 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 --- 3rdparty/libzipplugin/libzipplugin.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/3rdparty/libzipplugin/libzipplugin.cpp b/3rdparty/libzipplugin/libzipplugin.cpp index 4edbd29ed..646d42c43 100644 --- a/3rdparty/libzipplugin/libzipplugin.cpp +++ b/3rdparty/libzipplugin/libzipplugin.cpp @@ -183,6 +183,12 @@ PluginFinishType LibzipPlugin::extractFiles(const QList &files, const zip_close(archive); return PFT_Cancel; } else { // 处理错误 + // 密码错误, 给出错误提示 + if(ET_WrongPassword == m_eErrorType && !m_strPassword.isEmpty()) { + zip_close(archive); + m_strPassword = ""; + return PFT_Error; + } // 判断是否需要密码,若需要密码,弹出密码输入对话框,用户输入密码之后,重新解压当前文件 if (ET_WrongPassword == m_eErrorType || ET_NeedPassword == m_eErrorType) { PasswordNeededQuery query(strFileName); @@ -227,6 +233,13 @@ PluginFinishType LibzipPlugin::extractFiles(const QList &files, const zip_close(archive); return PFT_Cancel; } else { // 处理错误 + //密码错误, 给出错误提示 + if(ET_WrongPassword == m_eErrorType && !m_strPassword.isEmpty()) { + zip_close(archive); + m_strPassword = ""; + emit error(("Wrong password.")); + return PFT_Error; + } // 判断是否需要密码,若需要密码,弹出密码输入对话框,用户输入密码之后,重新解压当前文件 if (ET_WrongPassword == m_eErrorType || ET_NeedPassword == m_eErrorType) {