From d49515db3ec66c470e08c6a18ad8cf70b6016622 Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Mon, 21 Jul 2025 16:29:52 +0200 Subject: [PATCH] fix: dialog file filters and macOS app bundles (#47839) Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr --- shell/browser/ui/file_dialog_mac.mm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/shell/browser/ui/file_dialog_mac.mm b/shell/browser/ui/file_dialog_mac.mm index 98896b6dfac4..87d0a5a6ff10 100644 --- a/shell/browser/ui/file_dialog_mac.mm +++ b/shell/browser/ui/file_dialog_mac.mm @@ -122,6 +122,18 @@ void SetAllowedFileTypes(NSSavePanel* dialog, const Filters& filters) { if (ext == "*") { [content_types_set addObject:[UTType typeWithFilenameExtension:@"*"]]; break; + } else if (ext == "app") { + // This handles a bug on macOS where the "app" extension by default + // maps to "com.apple.application-file", which is for an Application + // file (older single-file carbon based apps), and not modern + // Application Bundles (multi file packages as you'd see for all modern + // applications). + UTType* superType = + [UTType typeWithIdentifier:@"com.apple.application-bundle"]; + if (UTType* utt = [UTType typeWithFilenameExtension:@"app" + conformingToType:superType]) { + [content_types_set addObject:utt]; + } } else { if (UTType* utt = [UTType typeWithFilenameExtension:@(ext.c_str())]) [content_types_set addObject:utt];