fix DownloadPipeline.fetch_many() crashing on a missing chunk - #10024
Merged
ThomasWaldmann merged 1 commit intoAug 3, 2026
Merged
Conversation
With replacement_chunk=False, fetch_many() is documented (and used) to yield None for a chunk that is missing in the repository - but the size check right before the yield then did len(None) and raised TypeError instead. borg webdav is currently the only caller that passes replacement_chunk=False for file content, so its "chunk missing" path (abort the connection instead of serving corrupted data) never actually ran: the TypeError ended up in the request error handler, which then tried to send a 500 for a response whose headers were already on the wire. Adds unit tests for both flavours of a missing chunk (the one without a replacement chunk fails without this fix) and an end-to-end webdav test for downloading a file with a chunk missing. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #10024 +/- ##
==========================================
+ Coverage 86.10% 86.14% +0.04%
==========================================
Files 96 96
Lines 17326 17326
Branches 2649 2649
==========================================
+ Hits 14918 14925 +7
+ Misses 1667 1663 -4
+ Partials 741 738 -3 ☔ View full report in Codecov by Harness. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split out of #10023 (where this was found), because it is an independent bug fix.
With
replacement_chunk=False,fetch_many()is documented (and used) to yieldNonefor achunk that is missing in the repository - but the size check right before the
yieldthen didlen(None)and raisedTypeErrorinstead.borg webdavis currently the only caller that passesreplacement_chunk=Falsefor filecontent, so its "chunk missing" path (abort the connection instead of serving corrupted data)
never actually ran: the
TypeErrorended up in the request error handler, which then tried tosend a 500 for a response whose headers were already on the wire.
It shows up as a test failure in #10023 because
borg mountreads viafetch_many()there,so
test_fuse_allow_damaged_filesreported EINVAL instead of EIO on all three FUSE legs.Tests: unit tests for both flavours of a missing chunk (the
replacement_chunk=Falseone failswithout this fix) and an end-to-end webdav test that deletes a chunk and expects the download
to be aborted rather than completed.
🤖 Generated with Claude Code