Skip to content

Commit

Permalink
fix off-by-one buglet in amazons3 backend module
Browse files Browse the repository at this point in the history
The internal logic uses python slices with half-open [start,end)
semantics but needs to translate to HTTP Range [start,end] closed
intervals.

This bug did not seem to impact actual hatrac clients, due to
other layers of the web framework trimming the extra byte we received
from S3. But, it can interfere with other direct use of the backend
API, such as in migration tools.
  • Loading branch information
karlcz committed Nov 30, 2023
1 parent f73088b commit 8acb297
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion hatrac/model/storage/amazons3.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ def get_content_range(self, name, version, metadata={},
limit = nbytes

if pos != 0 or limit != nbytes:
content_range = 'bytes=%d-%d' % (pos, limit)
content_range = 'bytes=%d-%d' % (pos, limit - 1)
else:
content_range = 'bytes=0-'

Expand Down

0 comments on commit 8acb297

Please sign in to comment.