ensure the filename returned has the desired extension