Set the correct filename for uri-list items

This commit is contained in:
Kovid Goyal 2026-05-14 14:42:52 +05:30
parent 7b30364bfd
commit 307717213b
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -4373,8 +4373,10 @@ - (void)draggingSession:(NSDraggingSession *)session
UTType *type = [UTType typeWithFilenameExtension:extension];
if (!type) type = UTTypeItem;
snprintf(buf, sizeof(buf), "kitty-internal/uri-list-item-%d", count);
NSString *filename = [url lastPathComponent];
GLFWFilePromiseProviderDelegate* delegate = [[[GLFWFilePromiseProviderDelegate alloc]
initWithWindow:window mimeType:buf fileName:NULL instanceId:_glfw.drag.instance_id] autorelease];
initWithWindow:window mimeType:buf fileName:[filename UTF8String]
instanceId:_glfw.drag.instance_id] autorelease];
NSFilePromiseProvider *provider = [[[NSFilePromiseProvider alloc]
initWithFileType:type.identifier delegate:delegate] autorelease];
// Store the delegate in the provider's user info so it's retained