In the following code:
dummy, filename, extension = decompose_file(current_file)
if extension:
extension = '.' + extension
A period was added to the beginning of the extension. However, when the
extension is returned from decompose_file, the period is already present at
its start. It is therefore now only added if it's not there to begin with.