mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user