From ff70e2e3ab1a21eede2ab60a4a7451a773a59dda Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 8 Feb 2026 21:54:20 +0530 Subject: [PATCH] Dont hardcode mimetype to extension mappings --- glfw/cocoa_window.m | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/glfw/cocoa_window.m b/glfw/cocoa_window.m index 7e6b9b266..9e1c598aa 100644 --- a/glfw/cocoa_window.m +++ b/glfw/cocoa_window.m @@ -900,13 +900,10 @@ cleanup_all_ns_pending_drag_source_data(_GLFWwindow* window) { // Generate a unique filename based on the MIME type NSString* extension = @"data"; if (mimeType) { - NSString* mt = @(mimeType); - if ([mt hasPrefix:@"text/"]) extension = @"txt"; - else if ([mt isEqualToString:@"image/png"]) extension = @"png"; - else if ([mt isEqualToString:@"image/jpeg"]) extension = @"jpg"; - else if ([mt isEqualToString:@"application/json"]) extension = @"json"; + UTType *type = [UTType typeWithMIMEType:@(mimeType)]; + extension = type.preferredFilenameExtension; } - return [NSString stringWithFormat:@"glfw-drag-%@.%@", [[NSUUID UUID] UUIDString], extension]; + return [NSString stringWithFormat:@"kitty-drag-%@.%@", [[NSUUID UUID] UUIDString], extension]; } - (void)filePromiseProvider:(NSFilePromiseProvider*)filePromiseProvider