Skip to content

Commit

Permalink
fix: send correct content-range header if requested byte range was tr…
Browse files Browse the repository at this point in the history
…uncated (#622)

Previously, if the requested byte range was truncated, an invalid
content-range header was sent.
  • Loading branch information
jbms authored Mar 23, 2024
1 parent 2689610 commit 281b0e2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions gcs/object.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,8 @@ def _download_range(self, request, response_payload):
begin = int(m.group(1))
end = int(m.group(2)) + 1
response_payload = response_payload[begin:end]
# Ensure end is correct if the specified byte range was truncated.
end = begin + len(response_payload)
m = re.match("bytes=([0-9]+)-$", range_header)
if m:
begin = int(m.group(1))
Expand Down

0 comments on commit 281b0e2

Please sign in to comment.