mirror of
https://codeberg.org/diginaut/digimarks.git
synced 2026-06-21 00:47:29 +02:00
Guard against None value
This commit is contained in:
@@ -49,7 +49,8 @@ async def set_information_from_source(bookmark: Bookmark, request: Request) -> B
|
||||
if bookmark.http_status == 200 or bookmark.http_status == 202:
|
||||
html_content = bs4.BeautifulSoup(result.text, 'html.parser')
|
||||
try:
|
||||
bookmark.title = html_content.title.text.strip()
|
||||
if html_content.title:
|
||||
bookmark.title = html_content.title.text.strip()
|
||||
except AttributeError as exc:
|
||||
logger.error('Error while trying to extract title from URL %s: %s', str(bookmark.url), str(exc))
|
||||
raise HTTPException(status_code=400, detail='Error while trying to extract title')
|
||||
|
||||
Reference in New Issue
Block a user