Fixed bug when adding attachments to directory-based couchapp.