Fix extension parsing for paths with a dot in the directory - close #1755