Skip to content

Conversation

@jjeff
Copy link
Owner

@jjeff jjeff commented Oct 3, 2025

Fixes an issue where custom macOS package types (like .rtfd) were not properly recognized in file dialogs when filtering by extension. The problem occurred because UTType creation didn't specify the package conformance, causing the system to not recognize these files as valid packages.

The fix attempts to create UTTypes with com.apple.package conformance first, then falls back to the regular method if that fails. This ensures that package extensions like .rtfd are properly recognized while maintaining compatibility with non-package file types.

Fixes electron#48191

🤖 Generated with Claude Code

Description of Change

Checklist

Release Notes

Notes:

Copilot AI review requested due to automatic review settings October 3, 2025 17:48
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes an issue where custom macOS package types (like .rtfd) were not properly recognized in file dialogs when filtering by extension. The fix modifies the UTType creation logic to first attempt creating UTTypes with package conformance before falling back to the regular method.

  • Adds a two-stage UTType creation approach: first try with package conformance, then fallback to regular creation
  • Ensures custom package extensions like .rtfd are properly recognized in file dialogs
  • Maintains backward compatibility with non-package file types

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +142 to +144
UTType* packageType = [UTType typeWithIdentifier:@"com.apple.package"];
UTType* utt = [UTType typeWithFilenameExtension:@(ext.c_str())
conformingToType:packageType];
Copy link

Copilot AI Oct 3, 2025

Choose a reason for hiding this comment

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

The packageType UTType is being created for every file extension in the loop. Consider moving this outside the loop to avoid redundant object creation.

Copilot uses AI. Check for mistakes.
// necessary for custom macOS packages like .rtfd to be recognized
// properly in file dialogs. If that fails, fall back to the regular
// method.
UTType* packageType = [UTType typeWithIdentifier:@"com.apple.package"];
Copy link

Copilot AI Oct 3, 2025

Choose a reason for hiding this comment

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

The hardcoded string 'com.apple.package' should be defined as a constant to improve maintainability and reduce the risk of typos.

Copilot uses AI. Check for mistakes.
zoy-l and others added 2 commits October 3, 2025 20:10
* fix: accentColor set distinguishes the frame

* chore: invalid change

* fix: lint
Fixes an issue where custom macOS package types (like .rtfd) were not
properly recognized in file dialogs when filtering by extension. The
problem occurred because UTType creation didn't specify the package
conformance, causing the system to not recognize these files as valid
packages.

The fix attempts to create UTTypes with com.apple.package conformance
first, then falls back to the regular method if that fails. This
ensures that package extensions like .rtfd are properly recognized
while maintaining compatibility with non-package file types.

Fixes electron#48191

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants