Skip to content

Fix download resume corruption when server returns HTTP 200 - #13014

Merged
TobiGr merged 1 commit into
TeamNewPipe:devfrom
jloutsch:fix/download-resume-corruption
Jan 9, 2026
Merged

TobiGr merged 1 commit into
TeamNewPipe:devfrom
jloutsch:fix/download-resume-corruption

Conversation

@jloutsch

@jloutsch jloutsch commented Jan 6, 2026 •

Copy link
Copy Markdown
Contributor

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). Changes required by user labels Jan 7, 2026
@TobiGr
TobiGr merged commit 6941248 into TeamNewPipe:dev Jan 9, 2026
6 checks passed
@TobiGr

TobiGr commented Jan 9, 2026

Copy link
Copy Markdown
Member

/backport release-0-28.1

@github-actions

github-actions Bot commented Jan 9, 2026

Copy link
Copy Markdown
Contributor

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). Changes required by user

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants