Skip to content

Commit

Permalink
Be a bit more defensive in determining EOF
Browse files Browse the repository at this point in the history
Just in case the reported end position is off the end of
the file.
  • Loading branch information
timj committed Apr 11, 2023
1 parent 3eda34a commit b3d9395
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def read(self, size: int = -1) -> bytes:
_, end = range.split("-")
end_pos = int(end)
if total != "*":
if end_pos == int(total) - 1:
if end_pos >= int(total) - 1:
self._eof = True
else:
self.log.warning("Requested byte range from server but instead got: %s", content_range)

Check warning on line 194 in python/lsst/resources/_resourceHandles/_httpResourceHandle.py

View check run for this annotation

Codecov / codecov/patch

python/lsst/resources/_resourceHandles/_httpResourceHandle.py#L194

Added line #L194 was not covered by tests
Expand Down

0 comments on commit b3d9395

Please sign in to comment.