loris-imageserver / loris

Loris IIIF Image Server
Other
208 stars 87 forks source link

Normalize content-type before extention computation in SimpleHTTPResolver #508

Open damooo opened 4 years ago

damooo commented 4 years ago

in SimpleHTTPResolver, when we are saving fie to cache, we are computing file-extension from request's content-type header. this extension will be then used in computing source_format at time of resolving.

But it is not normalizing content-type before dictionary lookup. Thus it doesn't support values like image/jpeg; charset=UTF-8, (archive.org responds like that.). We have to normalize it to image/jpeg before dictionary lookup.

Here is the place in code:

https://github.com/loris-imageserver/loris/blob/3c641eb90bdde33ad5fe8fd1d39a78d424f4a5d7/loris/resolver.py#L301