Clean up _getFileExtension() method and fix all its callers

Fixes #4575

The argument already was a file extension, so no need of this method.