extname is "" not nil, so we should use .empty? to test it.

I've screwed up. ext name for the file without an extension is not nil, its ''. That fixes this.