🧱 Chunk is a download manager for slow and unstable servers

Duplicate URLs in a single call write the same file concurrently #20

Open cuducos.me
Open opened by cuducos.me

Problem

DownloadWithContext spawns one goroutine per URL with no deduplication (downloader.go:410-417). Passing the same URL twice (or two URLs that map to the same local path) starts two goroutines writing the same file with interleaved WriteAt calls and sharing one progress file.

Impact

Corrupted output and garbled progress state.

Suggested fix

Dedupe URLs (or error on duplicates) before starting.

Sign up or Sign in to add to the discussion.