Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ repos:
name: mypy-storage
additional_dependencies:
- aiohttp
- gcloud-aio-auth>=5.3.0
- gcloud-aio-auth>=5.3.2
- rsa
- types-aiofiles
- types-requests
Expand Down
6 changes: 4 additions & 2 deletions storage/gcloud/aio/storage/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,12 +591,14 @@ async def _download(
# aiohttp and requests automatically decompress the body if this
# argument is not passed. We assume that if the Accept-Encoding header
# is present, then the client will handle the decompression
auto_decompress = 'accept-encoding' not in {k.lower() for k in headers}
auto_decompress = None # inherit the Session default setting
if 'accept-encoding' not in {k.lower() for k in headers}:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if 'accept-encoding' not in {k.lower() for k in headers}:
if 'accept-encoding' in {k.lower() for k in headers}:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we want want Kevin has here. If 'accept-encoding' in {k.lower() for k in headers} is True, that means that the session passes auto_decompress value implicitly in session, and we want None. We only want to set auto_decompress if 'accept-encoding' in {k.lower() for k in headers} is False, that is 'accept-encoding' is not in the headers.

auto_decompress = False

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

data: bytes
if not auto_decompress and BUILD_GCLOUD_REST:
if auto_decompress is False and BUILD_GCLOUD_REST:
# Requests lib has a different way of reading compressed data. We
# must pass the stream=True argument and read the response using
# the 'raw' property.
Expand Down
4 changes: 2 additions & 2 deletions storage/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion storage/poetry.rest.lock
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ test = ["pytest (>=6)"]

[[package]]
name = "gcloud-rest-auth"
version = "5.3.0"
version = "5.3.1"
description = "Python Client for Google Cloud Auth"
optional = false
python-versions = ">= 3.8, < 4.0"
Expand Down
2 changes: 1 addition & 1 deletion storage/pyproject.rest.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "gcloud-rest-storage"
version = "9.3.0"
version = "9.3.1"
description = "Python Client for Google Cloud Storage"
readme = "README.rst"

Expand Down
2 changes: 1 addition & 1 deletion storage/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "gcloud-aio-storage"
version = "9.3.0"
version = "9.3.1"
description = "Python Client for Google Cloud Storage"
readme = "README.rst"

Expand Down