mirror of https://github.com/zulip/zulip.git
Detect image-ness by end of path component, not end of entire URL
(imported from commit 9dd2e9c7273d3c7d071a8e5f82014e28b2a99ee4)
This commit is contained in:
parent
025b79d98b
commit
bc0dbbb566
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue