Skip to content

Commit e7fdf95

Browse files
committed
fix(storage): avoid overwriting user settings for auto_decompress
Rebase of talkiq#718
1 parent c4ee5cc commit e7fdf95

6 files changed

Lines changed: 21 additions & 16 deletions

File tree

.pre-commit-config.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,36 +111,36 @@ repos:
111111
name: mypy-bigquery
112112
additional_dependencies:
113113
- aiohttp==3.13.3
114-
- gcloud-aio-auth==5.4.2
114+
- gcloud-aio-auth==5.4.4
115115
- types-requests==2.32.4.20260107
116116
files: bigquery/
117117
- <<: *mypy
118118
name: mypy-datastore
119119
additional_dependencies:
120120
- aiohttp==3.13.3
121-
- gcloud-aio-auth==5.4.2
121+
- gcloud-aio-auth==5.4.4
122122
- types-requests==2.32.4.20260107
123123
files: datastore/
124124
- <<: *mypy
125125
name: mypy-kms
126126
additional_dependencies:
127127
- aiohttp==3.13.3
128-
- gcloud-aio-auth==5.4.2
128+
- gcloud-aio-auth==5.4.4
129129
- types-requests==2.32.4.20260107
130130
files: kms/
131131
- <<: *mypy
132132
name: mypy-pubsub
133133
additional_dependencies:
134134
- aiohttp==3.13.3
135-
- gcloud-aio-auth==5.4.2
135+
- gcloud-aio-auth==5.4.4
136136
- prometheus-client==0.24.1
137137
- types-requests==2.32.4.20260107
138138
files: pubsub/
139139
- <<: *mypy
140140
name: mypy-storage
141141
additional_dependencies:
142142
- aiohttp==3.13.3
143-
- gcloud-aio-auth==5.4.2
143+
- gcloud-aio-auth==5.4.4
144144
- rsa==4.9.1
145145
- types-aiofiles==25.1.0.20251011
146146
- types-requests==2.32.4.20260107
@@ -149,7 +149,7 @@ repos:
149149
name: mypy-taskqueue
150150
additional_dependencies:
151151
- aiohttp==3.13.3
152-
- gcloud-aio-auth==5.4.2
152+
- gcloud-aio-auth==5.4.4
153153
- types-requests==2.32.4.20260107
154154
files: taskqueue/
155155
- repo: https://github.com/asottile/yesqa

storage/gcloud/aio/storage/storage.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -622,14 +622,19 @@ async def _download(
622622
headers.update(await self._headers())
623623

624624
# aiohttp and requests automatically decompress the body if this
625-
# argument is not passed. We assume that if the Accept-Encoding header
626-
# is present, then the client will handle the decompression
627-
auto_decompress = 'accept-encoding' not in {k.lower() for k in headers}
625+
# argument is not passed, unless a user has explicitly disabled that
626+
# option at the session level in the case of aiohttp. We follow the
627+
# user setting by default (by passing None) and only explicitly disable
628+
# it when we know that the object is not compressed (when the
629+
# Accept-Encoding header is missing).
630+
auto_decompress = None
631+
if 'accept-encoding' not in {k.lower() for k in headers}:
632+
auto_decompress = False
628633

629634
s = AioSession(session) if session else self.session
630635

631636
data: bytes
632-
if not auto_decompress and BUILD_GCLOUD_REST:
637+
if auto_decompress is False and BUILD_GCLOUD_REST:
633638
# Requests lib has a different way of reading compressed data. We
634639
# must pass the stream=True argument and read the response using
635640
# the 'raw' property.

storage/poetry.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

storage/poetry.rest.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ test = ["pytest (>=6)"]
364364

365365
[[package]]
366366
name = "gcloud-rest-auth"
367-
version = "5.4.3"
367+
version = "5.4.4"
368368
description = "Python Client for Google Cloud Auth"
369369
optional = false
370370
python-versions = ">= 3.10, < 4.0"
@@ -682,4 +682,4 @@ zstd = ["backports-zstd (>=1.0.0) ; python_version < \"3.14\""]
682682
[metadata]
683683
lock-version = "2.1"
684684
python-versions = ">= 3.10, < 4.0"
685-
content-hash = "d7b69bb7dc20f1e0046a5ec92b531ba1ee19bfe6f0df054e1601aa194c0e2b58"
685+
content-hash = "bb040f27baa3c12a381ddfe8a43d67ef7c93fd774a8338b4ae6d55df4b8167f3"

storage/pyproject.rest.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ classifiers = [
2222
[tool.poetry.dependencies]
2323
python = ">= 3.10, < 4.0"
2424
# aiofiles = ">=0.6.0, <26.0.0"
25-
gcloud-rest-auth = ">= 5.3.0, < 6.0.0"
25+
gcloud-rest-auth = ">= 5.4.4, < 6.0.0"
2626
pyasn1-modules = ">=0.2.1, <0.5.0"
2727
rsa = ">= 3.1.4, < 5.0.0"
2828

storage/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ classifiers = [
2222
[tool.poetry.dependencies]
2323
python = ">= 3.10, < 4.0"
2424
aiofiles = ">=0.6.0, <26.0.0"
25-
gcloud-aio-auth = ">= 5.3.0, < 6.0.0"
25+
gcloud-aio-auth = ">= 5.4.4, < 6.0.0"
2626
pyasn1-modules = ">=0.2.1, <0.5.0"
2727
rsa = ">= 3.1.4, < 5.0.0"
2828

0 commit comments

Comments
 (0)