Do not use regex to check filetype to avoid being wrong since . is a regex metachar. It fixes #3817