1
0
mirror of https://codeberg.org/diginaut/digimarks.git synced 2026-06-21 11:07:32 +02:00

2 Commits

Author SHA1 Message Date
diginaut ec47066d41 Guard against None value 2026-05-19 20:00:27 +02:00
diginaut 39f4b43b7f Correct type for the directory settings 2026-03-29 13:17:29 +02:00
2 changed files with 5 additions and 3 deletions
+1
View File
@@ -49,6 +49,7 @@ async def set_information_from_source(bookmark: Bookmark, request: Request) -> B
if bookmark.http_status == 200 or bookmark.http_status == 202: if bookmark.http_status == 200 or bookmark.http_status == 202:
html_content = bs4.BeautifulSoup(result.text, 'html.parser') html_content = bs4.BeautifulSoup(result.text, 'html.parser')
try: try:
if html_content.title:
bookmark.title = html_content.title.text.strip() bookmark.title = html_content.title.text.strip()
except AttributeError as exc: except AttributeError as exc:
logger.error('Error while trying to extract title from URL %s: %s', str(bookmark.url), str(exc)) logger.error('Error while trying to extract title from URL %s: %s', str(bookmark.url), str(exc))
+3 -2
View File
@@ -4,6 +4,7 @@ import logging
from collections.abc import Sequence from collections.abc import Sequence
from contextlib import asynccontextmanager from contextlib import asynccontextmanager
from datetime import UTC, datetime from datetime import UTC, datetime
from pathlib import Path
from typing import Annotated, AsyncGenerator, cast from typing import Annotated, AsyncGenerator, cast
import httpx import httpx
@@ -36,8 +37,8 @@ class Settings(BaseSettings):
# inside the codebase # inside the codebase
# static_dir: DirectoryPath = Path('digimarks/static') # static_dir: DirectoryPath = Path('digimarks/static')
# template_dir: DirectoryPath = Path('digimarks/templates') # template_dir: DirectoryPath = Path('digimarks/templates')
static_dir: DirectoryPath = DirectoryPath('digimarks/static') static_dir: DirectoryPath = Path('digimarks/static')
template_dir: DirectoryPath = DirectoryPath('digimarks/templates') template_dir: DirectoryPath = Path('digimarks/templates')
media_url: str = '/static/' media_url: str = '/static/'