Fixes #4734 adds plugin hook for detecting mime type