Repository navigation
Conversation
Reviewer's GuideImplementationHandle the new split-ZIP MIME type in archive recognition, plugin selection, and archive parameter setup so split archives remain usable.
ConfigurationRegister split-ZIP globs under a dedicated MIME type to keep them from changing the preferred suffix for standard ZIP files.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: LiHua000 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 |
There was a problem hiding this comment.
Hey - I've found 3 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/assets/mimetype/deepin-compressor.xml" line_range="15" />
<code_context>
<glob pattern="*.7z.*" weight="80"/>
</mime-type>
- <mime-type type="application/zip">
+ <mime-type type="application/x-zip-split">
<comment>Zip split archive</comment>
<generic-icon name="deepin-compressor"/>
</code_context>
<issue_to_address>
**Split ZIP archives cannot open**
When a split ZIP volume is detected as `application/x-zip-split`, `determineMimeType()` returns `application/x-zip-split`, but the MIME type has no `application/zip` parent and the archive plugins advertise only `application/zip`. `PluginManager::filterBy()` finds no compatible plugin, so the archive cannot be opened or extracted.
Add an `application/zip` parent to the `application/x-zip-split` MIME definition.
</issue_to_address>
### Comment 2
<location path="src/assets/mimetype/deepin-compressor.xml" line_range="15" />
<code_context>
<glob pattern="*.7z.*" weight="80"/>
</mime-type>
- <mime-type type="application/zip">
+ <mime-type type="application/x-zip-split">
<comment>Zip split archive</comment>
<generic-icon name="deepin-compressor"/>
</code_context>
<issue_to_address>
**Misdetected split ZIPs lose ZIP identity**
When a valid split ZIP volume is assigned a non-default, non-ZIP MIME type by content detection, `determineMimeType()` no longer treats these filenames as ZIP extensions, so it skips the `file` fallback for a non-default content result and returns the content MIME type instead. Valid split ZIP volumes that content detection misidentifies as another type are therefore not recognized as ZIP archives.
Include the split ZIP MIME type in the ZIP detection fallback and map successful ZIP detection to a MIME type handled as ZIP.
</issue_to_address>
### Comment 3
<location path="src/assets/mimetype/deepin-compressor.xml" line_range="15" />
<code_context>
<glob pattern="*.7z.*" weight="80"/>
</mime-type>
- <mime-type type="application/zip">
+ <mime-type type="application/x-zip-split">
<comment>Zip split archive</comment>
<generic-icon name="deepin-compressor"/>
</code_context>
<issue_to_address>
**File manager omits split ZIP actions**
When the file manager matches a split ZIP file to `application/x-zip-split`, the desktop entry and file-manager extraction declarations list `application/zip`, not `application/x-zip-split`, so the file manager omits the compressor association and extract actions for split archives.
Add `application/x-zip-split` to the desktop entry and file-manager extraction MIME declarations.
</issue_to_address>| <glob pattern="*.7z.*" weight="80"/> | ||
| </mime-type> | ||
| <mime-type type="application/zip"> | ||
| <mime-type type="application/x-zip-split"> |
There was a problem hiding this comment.
🟠 High · Split ZIP archives cannot open
When a split ZIP volume is detected as application/x-zip-split, determineMimeType() returns application/x-zip-split, but the MIME type has no application/zip parent and the archive plugins advertise only application/zip. PluginManager::filterBy() finds no compatible plugin, so the archive cannot be opened or extracted.
Add an application/zip parent to the application/x-zip-split MIME definition.
Prompt for AI agents
In `src/assets/mimetype/deepin-compressor.xml` at line 15:
**Split ZIP archives cannot open**
When a split ZIP volume is detected as `application/x-zip-split`, `determineMimeType()` returns `application/x-zip-split`, but the MIME type has no `application/zip` parent and the archive plugins advertise only `application/zip`. `PluginManager::filterBy()` finds no compatible plugin, so the archive cannot be opened or extracted.
Add an `application/zip` parent to the `application/x-zip-split` MIME definition.| <glob pattern="*.7z.*" weight="80"/> | ||
| </mime-type> | ||
| <mime-type type="application/zip"> | ||
| <mime-type type="application/x-zip-split"> |
There was a problem hiding this comment.
🟡 Medium · Misdetected split ZIPs lose ZIP identity
When a valid split ZIP volume is assigned a non-default, non-ZIP MIME type by content detection, determineMimeType() no longer treats these filenames as ZIP extensions, so it skips the file fallback for a non-default content result and returns the content MIME type instead. Valid split ZIP volumes that content detection misidentifies as another type are therefore not recognized as ZIP archives.
Include the split ZIP MIME type in the ZIP detection fallback and map successful ZIP detection to a MIME type handled as ZIP.
Prompt for AI agents
In `src/assets/mimetype/deepin-compressor.xml` at line 15:
**Misdetected split ZIPs lose ZIP identity**
When a valid split ZIP volume is assigned a non-default, non-ZIP MIME type by content detection, `determineMimeType()` no longer treats these filenames as ZIP extensions, so it skips the `file` fallback for a non-default content result and returns the content MIME type instead. Valid split ZIP volumes that content detection misidentifies as another type are therefore not recognized as ZIP archives.
Include the split ZIP MIME type in the ZIP detection fallback and map successful ZIP detection to a MIME type handled as ZIP.| <glob pattern="*.7z.*" weight="80"/> | ||
| </mime-type> | ||
| <mime-type type="application/zip"> | ||
| <mime-type type="application/x-zip-split"> |
There was a problem hiding this comment.
🟠 High · File manager omits split ZIP actions
When the file manager matches a split ZIP file to application/x-zip-split, the desktop entry and file-manager extraction declarations list application/zip, not application/x-zip-split, so the file manager omits the compressor association and extract actions for split archives.
Add application/x-zip-split to the desktop entry and file-manager extraction MIME declarations.
Prompt for AI agents
In `src/assets/mimetype/deepin-compressor.xml` at line 15:
**File manager omits split ZIP actions**
When the file manager matches a split ZIP file to `application/x-zip-split`, the desktop entry and file-manager extraction declarations list `application/zip`, not `application/x-zip-split`, so the file manager omits the compressor association and extract actions for split archives.
Add `application/x-zip-split` to the desktop entry and file-manager extraction MIME declarations.1. Root cause: deepin-compressor.xml registered zip split archive globs under standard MIME type application/zip, causing update-mime-database to merge *.zip.[0-9][0-9][0-9] and *.z[0-9] into application/zip; preferredSuffix() then returned the glob pattern string instead of "zip", polluting zip format display 2. Fix: change MIME type name from application/zip to custom application/x-zip-split so split archive globs no longer merge with standard application/zip; add x-zip-split handling in isArchiveFile, createInterface, and MainWindow parameter setup so split zip archives are still recognized as zip 3. Impact: zip format dropdown shows correct suffix "zip" instead of glob pattern; zip compression works without "plugin failed" error; split zip archives (.zip.001) remain recognized and extractable; split archive icon display preserved Log: fix zip format dropdown showing wrong suffix and compression failure Influence: 1. Test zip compression: right-click compress, select zip format, verify dropdown shows "zip" and compression completes 2. Test zip split archive (.zip.001) recognition and extraction 3. Test zip split archive icon display for .zip.001 and .z01 files 4. Test 7z format compression is unaffected fix: 修复 zip 分卷压缩包 MIME 类型污染导致的格式显示错误 1. 根因:deepin-compressor.xml 将 zip 分卷压缩包 glob 注册在标准 MIME 类型 application/zip 下,update-mime-database 将 *.zip.[0-9][0-9][0-9] 和 *.z[0-9] 合并进 application/zip, 导致 preferredSuffix() 返回 glob 模式字符串而非 "zip",污染 zip 格式显示 2. 方案:将 MIME 类型名从 application/zip 改为自定义 application/x-zip-split,使分卷 glob 不再与标准 application/zip 合并;同时在 isArchiveFile、createInterface 及 MainWindow 参数设置中增加 x-zip-split 等价处理,确保分卷 zip 压缩包仍被识别为 zip 3. 影响:zip 格式下拉菜单正确显示 "zip" 而非 glob 模式;zip 压缩功能正常,不再提示"插件失败";分卷 zip 压缩包 (.zip.001)仍可正常识别和解压;分卷压缩包图标显示保持不变 Log: 修复 zip 格式下拉菜单显示错误后缀及压缩失败问题 Influence: 1. 测试 zip 压缩:右键压缩,选择 zip 格式,验证下拉菜单显示 "zip" 且压缩完成 2. 测试 zip 分卷压缩包(.zip.001)识别和解压功能正常 3. 测试 zip 分卷压缩包(.zip.001、.z01)图标显示正常 4. 测试 7z 格式压缩不受影响 PMS: BUG-383799
c16898a to
6e34ba3
Compare
Root Cause Analysis
commit
9de63eab(BUG-268375) registered zip split archive globs (*.zip.[0-9][0-9][0-9],*.z[0-9]) under the standard MIME typeapplication/zipindeepin-compressor.xmlwith weight=80, higher than the system*.zipglob (weight=50).update-mime-databasemerged these globs intoapplication/zip, causing Qt'sQMimeType::preferredSuffix()to return"zip.[0-9][0-9][0-9]"(literal brackets) instead of"zip". This polluted suffix propagated throughrefreshMenu()(display text) andslotCompressClicked()(filename construction), ultimately causingdetermineMimeType()to fail matching and produce "plugin failed" error.Key evidence:
src/assets/mimetype/deepin-compressor.xml:14-20,compresssettingpage.cpp:162,repro/before.log(Scenario 3 merged environment reproducedpreferredSuffix="zip.[0-9][0-9][0-9]").Fix Approach
Changed MIME type name from
application/zipto customapplication/x-zip-splitindeepin-compressor.xml, so split archive globs no longer merge with standardapplication/zip.preferredSuffix()forapplication/ziprestores to"zip", while split archive icon display is preserved via unchangedgeneric-iconconfiguration. This matches the root-cause-level fix (Plan A) adopted by the verifier, with no deviation from the analysis report's recommendation.Change Safety Assessment
Code Safety
9de63eab(BUG-268375 icon fix), but that fix relies ongeneric-iconwhich is preserved unchanged — no regression to icon displayBusiness Impact Scope
generic-iconconfiguration preservedVerification Suggestion
Test zip compression (right-click → compress → select zip → verify "zip" shown and compression succeeds); verify
.zip.001and.z01split archive icons still display; verify 7z compression unaffected.根因分析
commit
9de63eab(BUG-268375)在deepin-compressor.xml中将 zip 分卷压缩包 glob(*.zip.[0-9][0-9][0-9]、*.z[0-9])注册在标准 MIME 类型application/zip下(weight=80),高于系统*.zip(weight=50)。update-mime-database将这些 glob 合并进application/zip,导致 Qt 的QMimeType::preferredSuffix()返回"zip.[0-9][0-9][0-9]"(含字面方括号)而非"zip"。该错误后缀通过refreshMenu()(显示文本)和slotCompressClicked()(文件名拼接)传播,最终导致determineMimeType()匹配失败,产生"插件失败"错误。关键证据:
src/assets/mimetype/deepin-compressor.xml:14-20、compresssettingpage.cpp:162、repro/before.log(Scenario 3 合并环境复现preferredSuffix="zip.[0-9][0-9][0-9]")。修复方案
将
deepin-compressor.xml中 MIME 类型名从application/zip改为自定义application/x-zip-split,使分卷 glob 不再与标准application/zip合并。application/zip的preferredSuffix()恢复返回"zip",分卷压缩包图标显示通过不变的generic-icon配置保持正常。与复核采纳的方案 A(根因层修复)一致,无偏离。改动安全评估
代码安全评估
9de63eab(BUG-268375 图标修复),但该修复依赖generic-icon,本次改动保留不变,不回退图标修复业务影响范围
generic-icon配置保留不变验证建议
测试 zip 压缩(右键 → 压缩 → 选择 zip → 验证显示 "zip" 且压缩成功);验证
.zip.001和.z01分卷文件图标正常;验证 7z 压缩不受影响。Summary by Sourcery
Separate split ZIP archives from the standard ZIP MIME type while preserving their archive functionality and associations.
Bug Fixes:
Enhancements:
Chores: