fix: correct Content-Range end byte in chunked upload (RFC 7233)#212
Open
chrisdebian wants to merge 2 commits into
Open
fix: correct Content-Range end byte in chunked upload (RFC 7233)#212chrisdebian wants to merge 2 commits into
chrisdebian wants to merge 2 commits into
Conversation
Hard-coded 4096x1344 values only work for one specific GoPro MAX recording mode. Use exiftool computed-value syntax so CroppedArea and FullPano tags are derived from actual ImageWidth/ImageHeight, making the command work for any output resolution (e.g. 4096x2048). CroppedAreaTopPixels = (ImageWidth/2 - ImageHeight) / 2 Closes mapilio#200
The upload loop was sending `bytes={offset}-{entity_size}/{entity_size}`
for every chunk. RFC 7233 requires the end value to be the last byte of
the *current chunk* (0-indexed, inclusive), not the total entity size.
For multi-chunk uploads this caused the server to reject intermediate
chunks with "Invalid Content-Range provided" (MapSyncer issue mapilio#87).
Fix: compute `chunk_end = offset + len(chunk) - 1` for non-empty chunks
and keep the existing sentinel value for the empty finalisation request.
Adds two unit tests covering single-chunk and multi-chunk Content-Range
header construction.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This was referenced May 17, 2026
Contributor
Author
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.
Summary
Invalid "Content-Range" providederror when uploading large tracks (>64 MB, i.e. more than one chunk).upload_manager.pywas sendingbytes={offset}-{entity_size}/{entity_size}for every chunk. RFC 7233 requires the end value to be the last byte of the current chunk (0-indexed, inclusive), not the total file size. For multi-chunk uploads this meant every intermediate chunk carried an invalid range, causing the server to reject it.Root cause
Related issues
Test plan
pytest tests/test_upload_manager.py— 2 new tests passpytest— 97 tests passInvalid Content-Rangeerror🤖 Generated with Claude Code