fix code extension check, and set code files to text/plain