Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions 21 google/cloud/storage/_media/requests/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ def __init__(self, checksum):
super().__init__()
self._checksum = checksum

def decompress(self, data):
def decompress(self, data, max_length=-1):
"""Decompress the bytes.

Args:
Expand All @@ -721,7 +721,11 @@ def decompress(self, data):
bytes: The decompressed bytes from ``data``.
"""
self._checksum.update(data)
return super().decompress(data)
try:
return super().decompress(data, max_length=max_length)
except TypeError:
# Fallback for urllib3 < 2.6.0 which lacks `max_length` support.
return super().decompress(data)
chandra-siri marked this conversation as resolved.
Show resolved Hide resolved


# urllib3.response.BrotliDecoder might not exist depending on whether brotli is
Expand All @@ -747,7 +751,7 @@ def __init__(self, checksum):
self._decoder = urllib3.response.BrotliDecoder()
self._checksum = checksum

def decompress(self, data):
def decompress(self, data, max_length=-1):
"""Decompress the bytes.

Args:
Expand All @@ -757,10 +761,19 @@ def decompress(self, data):
bytes: The decompressed bytes from ``data``.
"""
self._checksum.update(data)
return self._decoder.decompress(data)
try:
return self._decoder.decompress(data, max_length=max_length)
except TypeError:
# Fallback for urllib3 < 2.6.0 which lacks `max_length` support.
return self._decoder.decompress(data)
chandra-siri marked this conversation as resolved.
Show resolved Hide resolved

def flush(self):
return self._decoder.flush()

@property
def has_unconsumed_tail(self) -> bool:
return self._decoder.has_unconsumed_tail
chandra-siri marked this conversation as resolved.
Show resolved Hide resolved


else: # pragma: NO COVER
_BrotliDecoder = None # type: ignore # pragma: NO COVER
1 change: 0 additions & 1 deletion 1 testing/constraints-3.12.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ grpcio
proto-plus
protobuf
grpc-google-iam-v1
urllib3==2.5.0
chandra-siri marked this conversation as resolved.
Show resolved Hide resolved
Morty Proxy This is a proxified and sanitized view of the page, visit original site.