Skip to content

Commit fde34fd

Browse files
itamarstpythonspeed
authored andcommitted
Temporary workaround for psf/cachecontrol#276 until it's fixed upstream.
1 parent fa87c9e commit fde34fd

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/pip/_vendor/cachecontrol/controller.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,17 @@ def update_cached_response(self, request, response):
407407
"""
408408
cache_url = self.cache_url(request.url)
409409

410-
cached_response = self.serializer.loads(request, self.cache.get(cache_url))
410+
# NOTE: This is a hot-patch for
411+
# https://github.com/ionrock/cachecontrol/issues/276 until it's fixed
412+
# upstream.
413+
if isinstance(self.cache, SeparateBodyBaseCache):
414+
body_file = self.cache.get_body(cache_url)
415+
else:
416+
body_file = None
417+
418+
cached_response = self.serializer.loads(
419+
request, self.cache.get(cache_url), body_file
420+
)
411421

412422
if not cached_response:
413423
# we didn't have a cached response

0 commit comments

Comments
 (0)