In some cases, simply appending a file extension will cause the resulting filename to have multiple file extensions (ugly!), especially when downloading from URLs. With this change, the function will remove any existing extension before appending a new one.
In some cases, simply appending a file extension will cause the resulting filename to have multiple file extensions (ugly!), especially when downloading from URLs. With this change, the function will remove any existing extension before appending a new one.