TextEdit bug with com.apple.quarantine extended attribute

I was having fun and games with the "This file has been downloaded from the Internet" message appearing even for files that I had created myself. I've finally been irked enough to track it down to a bug in TextEdit.

In Lion 10.7.4 open a Terminal shell. Then do:

$ cd ~/Documents
$ echo "fred" > test.txt
$ xattr test.txt

There is no output as no extended attributes are set. Now double-click test.txt in the Finder to open it using TextEdit and enter a few characters (e.g. add "bloggs" to the second line). No need to save. Go back to the console:

$ xattr test.txt


Go back to TextEdit, save the changes and com.apple.quarantine is gone (but TextEncoding remains as it (probably) should do.)

Go back again to TextEdit, type a few more characters and Quit (so that 'versions' retains a copy), and com.apple.quarantine is back.

Mostly this is an invisible problem however some of my AppleScript droplets complain with the message "This file has been downloaded from the Internet... etc"

Bruce Horrocks
(bruce at scorecrow dot com)