Downloader
Downloader copied to clipboard
Attempting to download the same file to the local directory with same name doesnt overwrite/replace
Description
When attempting to download the same file to the local directory with the same filename that exists already, the library is not overwriting/replacing or throwing any sort of error/message.
Usage
await DownloadBuilder.New()
.WithConfiguration(_downloadSettings)
.WithUrl(sourceUrl)
.WithDirectory(localPath)
.WithFileName(localFileName)
.Build()
.StartAsync();
How to reproduce
- Create a file/download a file from any source for this issue.
- Download to a determined
localPath
variable directory with thelocalFileName
variable valued file name. - Reattempt to download another file with the same
localFileName
to thelocalPath
- New file with size is not reflecting in the local path, but instead the old file is retained.
Reopening this, as the problem is, the library appends the new file being downloaded to the already existing file under the local path with the same name, instead of overwriting entirely or throwing an error.
For reproducing this,
- Download a sample csv file to the local path. (say, it may have 1000 rows)
- Download another different csv file to the local path, but with the same filename (say, it may have 5k rows)
- Check the file contents after 2nd download attempt
- File content seems to have merged or appended but not overwritten.
Hi @aravindk777, I have some unit tests and integration tests for this scenario and all of them passed. I think you have some config that can produce this issue. Please append your download config info to check more.
my test is: