Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
aravindk777 opened this issue Oct 31, 2023 · 2 comments
Assignees
Labels
good first issue Good for newcomers question Further information is requested
Projects

Comments

@aravindk777
Copy link

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 the localFileName variable valued file name.
  • Reattempt to download another file with the same localFileName to the localPath
  • New file with size is not reflecting in the local path, but instead the old file is retained.
@aravindk777 aravindk777 closed this as not planned Won't fix, can't repro, duplicate, stale Oct 31, 2023
@aravindk777
Copy link
Author

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.

@aravindk777 aravindk777 reopened this Oct 31, 2023
@bezzad bezzad self-assigned this Nov 2, 2023
@bezzad bezzad added good first issue Good for newcomers question Further information is requested labels Nov 2, 2023
@bezzad
Copy link
Owner

bezzad commented Nov 2, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers question Further information is requested
Projects
Downloader
Awaiting triage
Development

No branches or pull requests

2 participants