Skip to content

Conversation

@jloutsch
Copy link
Contributor

@jloutsch jloutsch commented Jan 6, 2026

What it does

When resuming a download and the server returns HTTP 200 (instead of 206), mMission.done is reset but start is not. This causes the file seek at line 91 to use a stale offset, writing data at the wrong position.

Related issue #12874

The fix

Reset start = 0 when HTTP 200 is received, so the write position correctly restarts from the beginning of the current resource.

Testing

Verified fix by downloading a large file, interrupting, and resuming. Seeking works correctly after the fix.

APK tested?

Yes - built and tested on physical device.

When resuming a download after interruption, if the server returns
HTTP 200 (full resource) instead of HTTP 206 (partial content), the
code correctly resets mMission.done but fails to reset the 'start'
variable. This causes the subsequent file seek to use a stale offset,
writing new data at incorrect positions.

This bug causes file corruption for large downloads (>5GB) that are
interrupted and resumed, particularly when:
- Switching between WiFi networks
- Server CDN returning different responses
- Connection drops during long downloads

The corruption manifests as duplicate data regions in the file,
which for MP4 downloads results in multiple MOOV atoms and
broken seek functionality.

Fix: Reset start=0 when HTTP 200 is received, ensuring the file
write position correctly restarts from the beginning of the current
resource.
@github-actions github-actions bot added the size/small PRs with less than 50 changed lines label Jan 6, 2026
@TobiGr TobiGr added bug Issue is related to a bug downloader Issue is related to the downloader template ignored The user didn't follow the template/instructions (or removed them) labels Jan 7, 2026
@TobiGr TobiGr merged commit 6941248 into TeamNewPipe:dev Jan 9, 2026
6 checks passed
@TobiGr
Copy link
Contributor

TobiGr commented Jan 9, 2026

/backport release-0-28.1

@github-actions
Copy link

github-actions bot commented Jan 9, 2026

Successfully created backport PR for release-0-28.1:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issue is related to a bug downloader Issue is related to the downloader size/small PRs with less than 50 changed lines template ignored The user didn't follow the template/instructions (or removed them)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants