move attachment type logic into common service

We already have a little bit of logic around mime-types, so we can reuse it when choosing icons