Moved header-based checking of mimetype into the existing utility function get_mime_type