[BUGFIX] Improve the way the extension of the file is extracted