fix bad attachment urls and encode them