Slightly robust check for mediatype