Factor out code to get the name of an attachment icon