Fix #1156 : Move mime detection hack to application level