Skip to content

Commit

Permalink
add a byte of headroom to max size to account for >=
Browse files Browse the repository at this point in the history
  • Loading branch information
H-Shay committed Jun 3, 2024
1 parent 94d9617 commit 26c3a6d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion synapse/http/matrixfederationclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -1502,7 +1502,8 @@ async def get_file(
raise SynapseError(HTTPStatus.TOO_MANY_REQUESTS, msg, Codes.LIMIT_EXCEEDED)

try:
d = read_body_with_max_size(response, output_stream, expected_size)
# add a byte of headroom to max size as function errs at >=
d = read_body_with_max_size(response, output_stream, expected_size + 1)
d.addTimeout(self.default_timeout_seconds, self.reactor)
length = await make_deferred_yieldable(d)
except BodyExceededMaxSize:
Expand Down

0 comments on commit 26c3a6d

Please sign in to comment.