Skip to content

Commit 560abe7

Browse files
committed
Fix caching error when response didn't set Content-Type header
1 parent 5ef78fa commit 560abe7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pulp_container/app/cache.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ async def make_response(self, key, base_key):
4141
"""Fix the Content-Type header to remove the charset."""
4242
response = await super().make_response(key, base_key)
4343
if response is not None:
44-
response.headers["Content-Type"] = response.headers["Content-Type"].split(";")[0]
44+
if content_type := response.headers.get("Content-Type"):
45+
response.headers["Content-Type"] = content_type.split(";")[0]
4546
return response
4647

4748

0 commit comments

Comments
 (0)