bezzad / Downloader

Fast, cross-platform and reliable multipart downloader with asynchronous progress events for .NET applications.
MIT License
1.25k stars 193 forks source link

Attempting to download the same file to the local directory with same name doesnt overwrite/replace #153

Open aravindk777 opened 8 months ago

aravindk777 commented 8 months ago

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

aravindk777 commented 8 months ago

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,

bezzad commented 8 months ago

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:

image