Receiving E-Mails in Cocoa app via file-promise drags from Mail.app does not work reliably.

Originator:frank.illenberger
Number:rdar://36400859 Date Originated:January 10 2018, 9:49 AM
Status:Open Resolved:
Product:macOS / AppKit Product Version:10.13.2
Classification:Other Reproducible:Always
 
Summary:
Receiving E-Mails in Cocoa app via file-promise drags from Mail.app does not work reliably.

Steps to reproduce:
- Download https://www.dropbox.com/s/xu83vw5394j0itl/MailAppFilePromiseBug.zip?dl=0
- Build and run "MailAppFilePromiseBug" with Xcode 9.2 under macOS 10.13.2 or later
- Onto the upcoming window, drag & drop a single e-mail from Mail.app
- Check the console log

Expected result:
The log should contain output like this:
2018-01-10 09:30:33.004117+0100 MailAppFilePromiseBug[5304:2763698] promisesDirectory: /var/folders/sh/bdrggr0j4t98t1d9tbng183h0000gn/T/89E54AF9-CCE5-4C11-B0C4-203289F6678D
2018-01-10 09:30:33.005117+0100 MailAppFilePromiseBug[5304:2763698] Promised file type: com.apple.mail.email
2018-01-10 09:30:33.008931+0100 MailAppFilePromiseBug[5304:2763698] Promised file URL: /var/folders/sh/bdrggr0j4t98t1d9tbng183h0000gn/T/89E54AF9-CCE5-4C11-B0C4-203289F6678D
2018-01-10 09:30:35.009623+0100 MailAppFilePromiseBug[5304:2763698] Created files: ("My test email.eml")

Actual result:
The log contains output like this:
2018-01-10 09:29:09.004117+0100 MailAppFilePromiseBug[5304:2763698] promisesDirectory: /var/folders/sh/bdrggr0j4t98t1d9tbng183h0000gn/T/89E54AF9-CCE5-4C11-B0C4-203289F6678D
2018-01-10 09:29:09.078981+0100 MailAppFilePromiseBug[5252:2755928] Promised file type: com.apple.mail.email
2018-01-10 09:29:09.083108+0100 MailAppFilePromiseBug[5252:2755928] Promised file URL: (null)
2018-01-10 09:29:11.083490+0100 MailAppFilePromiseBug[5252:2755928] Created files: ()

Further information:
- The problem does not occur, when dragging photos from Photos.app onto the test window.
- When uncommenting line 67 in ContentView.m, the problem does not occur after starting the test app for
  the second time.
- When dragging multiple e-mails, Mail.app even violates the file-promise handshake described in Pateboard.h by not providing a file type in kPasteboardTypeFilePromiseContent. To my mind, Mail.app should create a pasteboard item for every dragged e-mail.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!