escape file path when scanning mimetype

this fixes issues that come from whitespaces in file types