mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-04 22:34:56 -04:00
Fix crash in url preview when html tag has no text
Signed-off-by: Marcin Bachry <hegel666@gmail.com>
This commit is contained in:
parent
c3208e45c9
commit
24c16fc349
2 changed files with 54 additions and 1 deletions
|
@ -381,7 +381,10 @@ def _calc_og(tree, media_uri):
|
|||
if 'og:title' not in og:
|
||||
# do some basic spidering of the HTML
|
||||
title = tree.xpath("(//title)[1] | (//h1)[1] | (//h2)[1] | (//h3)[1]")
|
||||
og['og:title'] = title[0].text.strip() if title else None
|
||||
if title and title[0].text is not None:
|
||||
og['og:title'] = title[0].text.strip()
|
||||
else:
|
||||
og['og:title'] = None
|
||||
|
||||
if 'og:image' not in og:
|
||||
# TODO: extract a favicon failing all else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue