From 622f4d7dd14e2d0e52bf4bdd0ee569db155fd643 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Wed, 24 May 2017 20:21:55 -0500 Subject: [PATCH] Take image .ext from end of whole URL if not found at end of path. Taking from content-type on response would be difficult. --- fanficfare/story.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/fanficfare/story.py b/fanficfare/story.py index 27d4e486..de86f7b7 100644 --- a/fanficfare/story.py +++ b/fanficfare/story.py @@ -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])