Skip to content
This repository was archived by the owner on Sep 12, 2018. It is now read-only.

Commit cf0537e

Browse files
committed
Generalized content-encoding fix (mirroring)
1 parent fec140a commit cf0537e

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

docker_registry/lib/mirroring.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,13 @@ def wrapper(namespace, repository, *args, **kwargs):
7676
)
7777
if not source_resp:
7878
return resp
79-
return toolkit.response(data=source_resp.content,
80-
headers=source_resp.headers, raw=True)
79+
80+
headers = source_resp.headers
81+
if 'Content-Encoding' in headers:
82+
del headers['Content-Encoding']
83+
84+
return toolkit.response(data=source_resp.content, headers=headers,
85+
raw=True)
8186

8287
store = storage.load()
8388
request_path = flask.request.path
@@ -100,10 +105,14 @@ def wrapper(namespace, repository, *args, **kwargs):
100105
if not source_resp:
101106
return resp
102107
data = source_resp.content
108+
headers = source_resp.headers
109+
if 'Content-Encoding' in headers:
110+
del headers['Content-Encoding']
111+
103112
cache.redis_conn.setex('{0}:{1}'.format(
104113
cache.cache_prefix, tag_path
105114
), tags_cache_ttl, data)
106-
return toolkit.response(data=data, headers=source_resp.headers,
115+
return toolkit.response(data=data, headers=headers,
107116
raw=True)
108117
return wrapper
109118

0 commit comments

Comments
 (0)