1
0
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:
2026-05-19 20:00:27 +02:00
parent 39f4b43b7f
commit ec47066d41
+2 -1
View File
@@ -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')