in cleanAttachmentURI, improved handling of malformed URIs