Skip to content
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
b0a3349
test
chandra-siri Nov 3, 2025
778e68e
Revert "test"
chandra-siri Nov 3, 2025
33a998e
Merge branch 'googleapis:main' into main
chandra-siri Nov 3, 2025
d49d31d
Merge branch 'main' of github.com:googleapis/python-storage
chandra-siri Nov 4, 2025
ddbc1dd
Merge branch 'main' of github.com:googleapis/python-storage
chandra-siri Nov 19, 2025
3a1aac4
Merge branch 'main' of github.com:googleapis/python-storage
chandra-siri Dec 4, 2025
ee259d4
Merge branch 'main' of github.com:googleapis/python-storage
chandra-siri Dec 4, 2025
e66761a
Merge branch 'main' of github.com:googleapis/python-storage
chandra-siri Dec 7, 2025
633fb36
Merge branch 'main' of github.com:googleapis/python-storage
chandra-siri Dec 8, 2025
c1ec22e
Merge branch 'main' of github.com:chandra-siri/python-storage
chandra-siri Dec 9, 2025
ff08e0d
Merge branch 'main' of github.com:googleapis/python-storage
chandra-siri Dec 9, 2025
959bc49
feat: Support urllib3's custom decoder, add max_length param
chandra-siri Dec 9, 2025
ed13aef
Revert "chore: fix failing system test due to version upgrade of urll…
chandra-siri Dec 9, 2025
cdebf9f
Merge branch 'main' into support_urllib3_2_6_0
chandra-siri Dec 9, 2025
ccb702e
expose `has_unconsumed_tail` property in _BrotliDecoder
chandra-siri Dec 9, 2025
0340cda
Merge branch 'support_urllib3_2_6_0' of github.com:chandra-siri/pytho…
chandra-siri Dec 9, 2025
452006e
keep `max_length` default value -1 same as urllib3
chandra-siri Dec 9, 2025
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 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)


# 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)

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

@property
def has_unconsumed_tail(self) -> bool:
return self._decoder.has_unconsumed_tail


else: # pragma: NO COVER
_BrotliDecoder = None # type: ignore # pragma: NO COVER
1 change: 0 additions & 1 deletion 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