Skip to content

fix: add zip split archive MIME icon definition - #469

Open
pengfeixx wants to merge 1 commit into
release/eaglefrom
agent/pms-bug-bot/5e978b0b
Open

fix: add zip split archive MIME icon definition#469
pengfeixx wants to merge 1 commit into
release/eaglefrom
agent/pms-bug-bot/5e978b0b

Conversation

@pengfeixx

@pengfeixx pengfeixx commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Root Cause Analysis

The deepin-compressor MIME package (src/assets/mimetype/deepin-compressor.xml) only defines a custom MIME type with generic-icon=deepin-compressor for 7z split archives (application/x-7z-compressed + glob *.7z.*). Zip split archive sub-files have no MIME/glob/icon definition, so they fall back to generic or unknown icons in the file manager, causing icon inconsistency between the main archive and its parts. The two zip split naming formats are confirmed in src/source/common/uitools.cpp:342 transSplitFileName: format A (.zip.001, .zip.002…) and format B (.zip + .z01, .z02…).

Fix

Added a new <mime-type type="application/x-zip-split"> entry to deepin-compressor.xml, with two glob patterns (*.zip.[0-9]* and *.z[0-9]*, both at weight 80) covering both zip split naming formats, and generic-icon=deepin-compressor to ensure sub-files display the same icon as the main archive. The new entry follows the existing 7z split definition pattern and does not modify any existing definitions.

Change Safety Assessment

Code Safety

  • Risk Level: Low
  • This is a pure data-file addition (XML MIME package) — no code logic, function signatures, or callers are modified; References=0.
  • The target MIME definition is not a historical bug-fix product; this addition does not revert any prior change.

Business Impact Scope

  • File manager icon display: Zip split archive sub-files (.zip.001/.zip.002… and .z01/.z02…) will now display the deepin-compressor icon.
  • Format B (.zip + .z0N) main .zip file still matches the system application/zip MIME type and shows the system zip icon. Overriding application/zip's generic-icon would affect ALL zip files (including non-split regular zip), so this is intentionally NOT done. The main/sub icon difference for format B remains and is documented here as a known limitation.
  • 7z split archives and regular zip files are unaffected (regression-safe).

Verification Suggestion

Verify that both zip split naming formats show the deepin-compressor icon for sub-files, and that 7z split and regular zip icons are unchanged.


根因分析

归档管理器 MIME 包(src/assets/mimetype/deepin-compressor.xml)仅对 7z 分卷定义了自定义 MIME 类型及 generic-icon=deepin-compressorapplication/x-7z-compressed + glob *.7z.*),zip 分卷子文件缺少 MIME/glob/icon 定义,在文件管理器中回退为通用/未知图标,导致主文件与子文件图标显示不一致。两种 zip 分卷命名格式在 src/source/common/uitools.cpp:342 transSplitFileName 中确认:格式 A(.zip.001.zip.002…)与格式 B(.zip + .z01.z02…)。

修复方案

deepin-compressor.xml 中新增 <mime-type type="application/x-zip-split"> 条目,配置两个 glob 模式(*.zip.[0-9]**.z[0-9]*,weight 80)覆盖 zip 分卷两种命名格式,并设置 generic-icon=deepin-compressor 使子文件与主文件图标一致。新增条目参照已有 7z 分卷定义模式,不修改任何已有定义。

改动安全评估

代码安全评估

  • 风险等级: 低风险
  • 本次为纯数据文件(XML MIME 包)新增条目,不涉及代码逻辑、函数签名或调用者,References=0
  • 目标 MIME 定义非历史 bug 修复产物,本次新增不撤销任何历史改动。

业务影响范围

  • 文件管理器图标显示:zip 分卷压缩包子文件(.zip.001/.zip.002… 和 .z01/.z02…)将统一显示 deepin-compressor 图标。
  • 格式 B(.zip + .z0N)主文件 .zip 仍命中系统 application/zip 类型,显示系统 zip 图标。覆盖 application/zipgeneric-icon 会影响所有 zip 文件(含非分卷普通 zip),风险过高,本次有意不做覆盖。格式 B 主/子图标差异作为已知限制在此说明。
  • 7z 分卷和普通 zip 文件不受影响(回归安全)。

验证建议

验证两种 zip 分卷命名格式的子文件均显示 deepin-compressor 图标,且 7z 分卷和普通 zip 图标无变化。

PMS: BUG-268375

Summary by Sourcery

Bug Fixes:

  • Add MIME recognition for ZIP split archive parts so they display the deepin-compressor icon.

1. Root cause: deepin-compressor.xml only defines MIME type and
   generic-icon for 7z split archives, missing zip split sub-files
2. Fix: add application/x-zip-split MIME type with glob patterns
   *.zip.[0-9]* and *.z[0-9]* to cover both zip split naming formats
3. Impact: zip split sub-files now display deepin-compressor icon

Log: zip split archive sub-files now show consistent deepin-compressor icon

Influence:
1. Verify zip split format A (.zip.001, .zip.002...) sub-file icons
2. Verify zip split format B (.z01, .z02...) sub-file icons
3. Verify 7z split and regular zip icons are unaffected

fix: 补充zip分卷压缩包子文件MIME图标定义

1. 根因:deepin-compressor.xml 仅定义了 7z 分卷的 MIME 类型和
   generic-icon,缺少 zip 分卷子文件的定义
2. 方案:新增 application/x-zip-split MIME 类型,glob 模式
   *.zip.[0-9]* 和 *.z[0-9]* 覆盖 zip 分卷两种命名格式
3. 影响:zip 分卷子文件图标统一显示为 deepin-compressor 图标

Log: zip分卷压缩包子文件图标统一显示为deepin-compressor图标

Influence:
1. 验证zip分卷格式A(.zip.001、.zip.002...)子文件图标
2. 验证zip分卷格式B(.z01、.z02...)子文件图标
3. 验证7z分卷和普通zip文件图标不受影响

PMS: BUG-268375
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: pengfeixx

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sourcery-ai

sourcery-ai Bot commented Aug 23, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds a new MIME type definition for ZIP split archive parts to the deepin-compressor MIME XML so that split ZIP sub-files get the deepin-compressor icon, mirroring the existing 7z split handling, without changing any existing MIME entries.

File-Level Changes

Change Details Files
Define a dedicated MIME type for ZIP split archive parts and associate it with the deepin-compressor icon and appropriate glob patterns.
  • Add a new application/x-zip-split entry alongside the existing 7z split definition.
  • Set the generic-icon for ZIP split parts to deepin-compressor to align sub-file icons with the main archive.
  • Register glob patterns for both supported ZIP split naming schemes (.zip.[0-9] and .z[0-9]), with weight 80 for each glob.
src/assets/mimetype/deepin-compressor.xml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants