fixes extension
only set extension and mimetype if filetype seems to be given