From ff61dd7d26734638aea01ee85e7bebff01a89aad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=B0=A6=E0=B0=BE=E0=B0=AE=E0=B1=8B=E0=B0=A6=E0=B0=B0?= Date: Sat, 22 Aug 2020 10:59:44 +0530 Subject: [PATCH] Normalize content-type before extention computation in SimpleHTTPResolver fixes #508 --- loris/resolver.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/loris/resolver.py b/loris/resolver.py index 9c5c838f..522a6e81 100644 --- a/loris/resolver.py +++ b/loris/resolver.py @@ -298,7 +298,8 @@ def cached_file_for_ident(self, ident): def cache_file_extension(self, ident, response): if 'content-type' in response.headers: try: - extension = self.get_format(ident, constants.FORMATS_BY_MEDIA_TYPE[response.headers['content-type']]) + content_type = response.headers['content-type'].split(';')[0] + extension = self.get_format(ident, constants.FORMATS_BY_MEDIA_TYPE[content_type]) except KeyError: logger.warn('Your server may be responding with incorrect content-types. Reported %s for ident %s.', response.headers['content-type'], ident)