backport fix from TG2.3 on mime type detection