mirror of https://github.com/CIRCL/lookyloo
fix: avoid exceptions on invalid capture settings
parent
b9b6c3601a
commit
fb50cddc8f
|
@ -433,8 +433,8 @@ class CapturesIndex(Mapping): # type: ignore[type-arg]
|
|||
with capture_settings_file.open() as f:
|
||||
capture_settings = json.loads(f.read())
|
||||
|
||||
if capture_settings.get('url') and capture_settings['url'] is not None:
|
||||
cache['url'] = capture_settings['url']
|
||||
if capture_settings.get('url') and capture_settings['url'] is not None:
|
||||
cache['url'] = capture_settings['url']
|
||||
|
||||
if (capture_dir / 'error.txt').exists():
|
||||
# Something went wrong
|
||||
|
|
|
@ -29,7 +29,7 @@ from werkzeug.user_agent import UserAgent
|
|||
from werkzeug.utils import cached_property
|
||||
|
||||
from .default import get_homedir, safe_create_dir, get_config, LookylooException
|
||||
from .exceptions import InvalidCaptureSetting
|
||||
# from .exceptions import InvalidCaptureSetting
|
||||
|
||||
|
||||
logger = logging.getLogger('Lookyloo - Helpers')
|
||||
|
@ -139,7 +139,9 @@ def cast_capture_settings(capture_settings: dict[str, str]) -> CaptureSettings:
|
|||
# Value is a non-empty string, keep it as-is
|
||||
to_return[setting_key] = setting_value # type: ignore[literal-required]
|
||||
else:
|
||||
raise InvalidCaptureSetting(f'Unknown setting: {setting_key} with value: {setting_value}')
|
||||
# NOTE: we may have to add more settings here, will be fixed with pydantic soon.
|
||||
# raise InvalidCaptureSetting(f'Unknown setting: {setting_key} with value: {setting_value}')
|
||||
print(f'Unknown setting: {setting_key} with value: {setting_value}')
|
||||
return to_return
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue