Detect image-ness by end of path component, not end of entire URL

(imported from commit 9dd2e9c7273d3c7d071a8e5f82014e28b2a99ee4)
This commit is contained in:
Reid Barton 2013-03-05 18:03:45 -05:00
parent 025b79d98b
commit bc0dbbb566
1 changed files with 2 additions and 1 deletions

View File

@ -15,9 +15,10 @@ from zephyr.lib.timeout import timeout
class InlineImagePreviewProcessor(markdown.treeprocessors.Treeprocessor):
def is_image(self, url):
parsed_url = urlparse.urlparse(url)
# List from http://support.google.com/chromeos/bin/answer.py?hl=en&answer=183093
for ext in [".bmp", ".gif", ".jpg", "jpeg", ".png", ".webp"]:
if url.lower().endswith(ext):
if parsed_url.path.lower().endswith(ext):
return True
return False