Take image .ext from end of whole URL if not found at end of path. Taking from content-type on response would be difficult.

This commit is contained in:
Jim Miller 2017-05-24 20:21:55 -05:00
parent e6ca5da2c9
commit 622f4d7dd1

View file

@ -149,9 +149,13 @@ def no_convert_image(url,data):
ext=parsedUrl.path[parsedUrl.path.rfind('.')+1:].lower()
if ext not in imagetypes:
logger.debug("no_convert_image url:%s - no known extension"%url)
# doesn't have extension? use jpg.
ext='jpg'
# not found at end of path, try end of whole URL in case of
# parameter.
ext = url[url.rfind('.')+1:].lower()
if ext not in imagetypes:
logger.debug("no_convert_image url:%s - no known extension"%url)
# doesn't have extension? use jpg.
ext='jpg'
return (data,ext,imagetypes[ext])