Skip to content

feat: exclude Mac metadata with optional Windows filename checks - #319

Open
athousanddetails wants to merge 2 commits into
sarensw:mainfrom
athousanddetails:feat/exclude-mac-metadata
Open

athousanddetails wants to merge 2 commits into
sarensw:mainfrom
athousanddetails:feat/exclude-mac-metadata

Conversation

@athousanddetails

@athousanddetails athousanddetails commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Reopened copy of #287. The original was closed when my fork was deleted by mistake; the code is unchanged. Screenshots that were hosted on the old fork may no longer load.

What & why

Adds an opt-in Exclude Mac-specific metadata setting for compression and archive saves. It leaves out .DS_Store, AppleDouble metadata, resource forks and Finder metadata while preserving ordinary files with sidecar-like names. The default continues preserving metadata.

A nested, opt-in Windows-compatible filenames setting rejects unsupported names and case/file-folder collisions before writing, listing the affected entries without renaming anything. It checks new, kept and renamed entries. This is a filename check, not a guarantee about Windows codecs, symbolic links or the destination's total path length.

Addresses the metadata-setting portion of #236. This PR deliberately does not add the proposed “Compress for Windows” Finder action or automatic normalization, so it does not automatically close the broader issue. No versions or vendored submodules changed.

How it was verified

  • 587 tests in 139 suites passed (123.963 seconds). Tests cover metadata on/off, resource forks, Finder tags, hidden flags, custom folder icons, encrypted ZIP/7z, Save/Save As, sidecar-lookalike user files, filename conflicts (including generated sidecar paths), and original/destination preservation on rejection.
  • Unsigned MacPacker Release and MacPacker Store Release Store builds succeeded locally. Architecture guard: 15 Mach-O files checked, every one has arm64 and x86_64 slices.
  • Manual UI verification in an isolated local build: the child option is initially off/disabled, enabling its parent makes it available, and Save As lists all four conflicting names below without creating an output archive. The installed app was not replaced.
  • Verification output.
Before After
General settings before General settings after

Save As refuses incompatible and colliding names

The string catalog is committed as generated by Xcode tooling, including locale-tag normalization and formatting; no translations were hand-edited there.

Review follow-up: added translator context to the Windows filename setting and now checks generated Mac metadata paths for case-insensitive collisions before writing. Both review threads are resolved.

Changelog

The first changelog block is 1.0.0, already tagged as v1.0.0. Per AGENTS.md, a new block is needed; no version is chosen here. The contributor approved the English title before these translations were prepared. Full item for the next block:

{
  "type": "feat",
  "title": {
    "en": "Exclude Mac-specific metadata",
    "de": "Mac-spezifische Metadaten ausschließen",
    "es-MX": "Excluir metadatos específicos de Mac",
    "fa": "حذف فراداده‌های مخصوص Mac",
    "fr": "Exclure les métadonnées propres au Mac",
    "it": "Escludi i metadati specifici del Mac",
    "ja": "Mac固有のメタデータを除外",
    "ko": "Mac 전용 메타데이터 제외",
    "nl": "Mac-specifieke metadata uitsluiten",
    "pl": "Pomijanie metadanych specyficznych dla Maca",
    "pt-BR": "Excluir metadados específicos do Mac",
    "ru": "Исключение метаданных Mac",
    "tr": "Mac’e özgü meta verileri hariç tut",
    "uk": "Виключення метаданих Mac",
    "vi": "Loại bỏ siêu dữ liệu dành riêng cho Mac",
    "zh-Hans": "排除 Mac 专属元数据"
  },
  "issues": [
    "236"
  ]
}

Checklist

  • Verification evidence is included above
  • Changelog item supplied above under the tagged-release exception in AGENTS.md
  • AI involvement disclosed: Codex was the primary code author. Gustavo Lima reviewed and approved the behavior and evidence; automated and manual UI checks described above were performed with Codex assistance.

Summary by CodeRabbit

  • New Features
    • Added options to exclude Mac-specific metadata and require Windows-compatible filenames when creating archives. Filename checks identify invalid or conflicting names before saving; files are not renamed.
    • Applied saved file preferences to archive creation and added checks for generated metadata files.
    • Added coverage for metadata handling, filename validation, and archive-saving behavior.

@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

📝 Walkthrough

Walkthrough

The PR adds settings for excluding Mac metadata and requiring Windows-compatible archive names. It applies these settings during archive saves, filters verified Mac metadata, and checks archive entry names before writing when validation is enabled.

Changes

Archive file options

Layer / File(s) Summary
File preference settings and option application
Modules/Sources/Swift7zip/CompressionOptions.swift, Modules/Sources/Core/AppStorageKeys.swift, MacPacker/Features/Settings/GeneralSettingsView.swift, Modules/Sources/Core/Settings/ArchiveSaveOptions.swift, Modules/Sources/Core/ArchiveSaver.swift, Modules/Tests/CoreTests/MacMetadataOptionsTests.swift, Modules/Tests/CoreTests/WindowsArchiveNamesTests.swift
Compression options and persisted settings include Mac metadata exclusion and Windows-compatible name validation. The settings UI exposes both options. ArchiveSaver applies preferences to options before storing them.
Mac metadata filtering
Modules/Sources/Swift7zip/SevenZipWriter.swift, Modules/Tests/CoreTests/MacMetadataOptionsTests.swift
Archive writes filter .DS_Store entries and verify stored AppleDouble sidecars before excluding them. Tests cover metadata inclusion and removal, encrypted archives, and existing archives.
Windows-compatible name validation
Modules/Sources/Swift7zip/WindowsArchiveNames.swift, Modules/Sources/Swift7zip/SevenZipWriter.swift, Modules/Tests/CoreTests/WindowsArchiveNamesTests.swift
WindowsArchiveNames identifies invalid names and path collisions. SevenZipWriter checks resolved entries and generated sidecars before writing when validation is required. Tests cover rejected writes, preserved destinations, and renamed entries.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant GeneralSettingsView
  participant UserDefaults
  participant ArchiveSaveOptions
  participant ArchiveSaver
  participant SevenZipWriter
  participant WindowsArchiveNames
  GeneralSettingsView->>UserDefaults: Persist file preference values
  ArchiveSaver->>ArchiveSaveOptions: Apply file preferences to compression options
  ArchiveSaveOptions-->>ArchiveSaver: Return adjusted options
  SevenZipWriter->>WindowsArchiveNames: Check resolved entry and sidecar names
  WindowsArchiveNames-->>SevenZipWriter: Return conflicting paths
Loading

Merge Risk: 🔵 Low · up to ccad0

The documentation placement is misleading but does not affect archive behavior. The change is mergeable with this minor cleanup left to the owner.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 42.11% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 19 functions across 9 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely summarizes the pull request's main changes: optional Mac metadata exclusion and Windows-compatible filename checks.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
⚔️ Resolve merge conflicts 💡
  • Resolve merge conflict in branch feat/exclude-mac-metadata

🧪 Generate unit tests (beta)
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

🔇 Additional comments (9)
Modules/Sources/Swift7zip/CompressionOptions.swift (1)

157-163: LGTM!

Also applies to: 180-182, 196-197

Modules/Sources/Core/Settings/ArchiveSaveOptions.swift (1)

172-183: LGTM!

Modules/Sources/Core/ArchiveSaver.swift (1)

70-70: LGTM!

Modules/Tests/CoreTests/MacMetadataOptionsTests.swift (1)

1-100: LGTM!

Modules/Tests/CoreTests/WindowsArchiveNamesTests.swift (1)

1-99: LGTM!

Modules/Sources/Swift7zip/SevenZipWriter.swift (1)

55-55: LGTM!

Also applies to: 95-95, 154-158, 168-174, 226-254, 260-262, 299-303, 312-316, 330-369

Modules/Sources/Swift7zip/WindowsArchiveNames.swift (1)

1-49: LGTM!

MacPacker/Features/Settings/GeneralSettingsView.swift (1)

126-138: 📐 Maintainability & Code Quality

The catalog already contains all four new literals, so the proposed review comment is not supported.

Modules/Sources/Core/AppStorageKeys.swift (1)

72-74: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

⚠️ Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Fix the misplaced doc comments.

The .DS_Store doc comment on lines 70-71 now sits above excludeMacMetadata, not above saveOptionsExcludeDSStore. The new comment on line 72 also documents only excludeMacMetadata. Move the new keys above the .DS_Store comment.

♻️ Proposed fix
-    /// Leave `.DS_Store` files out of archives. Off by default, as in Finder's
-    /// own Compress.
     /// Global compression choice, shared by saves, Quick Compress and Finder actions.
     public static let excludeMacMetadata = "excludeMacMetadata"
     public static let requireWindowsCompatibleNames = "requireWindowsCompatibleNames"
+    /// Leave `.DS_Store` files out of archives. Off by default, as in Finder's
+    /// own Compress.
     public static let saveOptionsExcludeDSStore = "saveOptionsExcludeDSStore"

ℹ️ Review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 48290892-e8d1-4690-97f6-76938f7d79c0
📥 Commits

Reviewing files that changed from the base of the PR and between 3b505ef and ccad0b7.

📒 Files selected for processing (10)
  • MacPacker/Features/Settings/GeneralSettingsView.swift
  • MacPacker/Localizable.xcstrings
  • Modules/Sources/Core/AppStorageKeys.swift
  • Modules/Sources/Core/ArchiveSaver.swift
  • Modules/Sources/Core/Settings/ArchiveSaveOptions.swift
  • Modules/Sources/Swift7zip/CompressionOptions.swift
  • Modules/Sources/Swift7zip/SevenZipWriter.swift
  • Modules/Sources/Swift7zip/WindowsArchiveNames.swift
  • Modules/Tests/CoreTests/MacMetadataOptionsTests.swift
  • Modules/Tests/CoreTests/WindowsArchiveNamesTests.swift

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

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.

1 participant