Skip to content

Commit

Permalink
Normalize content-type before extention computation in SimpleHTTPReso…
Browse files Browse the repository at this point in the history
…lver

fixes loris-imageserver#508
  • Loading branch information
damooo authored Aug 22, 2020
1 parent 3c641eb commit ff61dd7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion loris/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ff61dd7

Please sign in to comment.