mirror of https://github.com/zulip/zulip.git
url_preview: Fix crash when description has no content.
There's several things we'll want to cleanup with this feature, but for now we're content to just make this not crash.
This commit is contained in:
parent
d5e7b9599d
commit
3006b3f52f
|
@ -20,7 +20,7 @@ class GenericParser(BaseParser):
|
|||
def _get_description(self) -> Optional[str]:
|
||||
soup = self._soup
|
||||
meta_description = soup.find('meta', attrs={'name': 'description'})
|
||||
if (meta_description and meta_description['content'] != ''):
|
||||
if (meta_description and meta_description.get('content', '') != ''):
|
||||
return meta_description['content']
|
||||
first_h1 = soup.find('h1')
|
||||
if first_h1:
|
||||
|
|
Loading…
Reference in New Issue