mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-26 01:06:23 +02:00
fix(backend): handle non-string elements in webcrawler URL list
Add isinstance check to prevent AttributeError when INITIAL_URLS list contains non-string elements (None, int, dict) from malformed config data.
This commit is contained in:
parent
ecb5572e69
commit
20b8a17254
1 changed files with 1 additions and 4 deletions
|
|
@ -1,8 +1,5 @@
|
|||
"""
|
||||
Utility functions for webcrawler connector.
|
||||
|
||||
This module is intentionally kept separate from the connector_indexers package
|
||||
to avoid circular import issues.
|
||||
"""
|
||||
|
||||
|
||||
|
|
@ -24,6 +21,6 @@ def parse_webcrawler_urls(initial_urls: str | list | None) -> list[str]:
|
|||
if isinstance(initial_urls, str):
|
||||
return [url.strip() for url in initial_urls.split("\n") if url.strip()]
|
||||
elif isinstance(initial_urls, list):
|
||||
return [url.strip() for url in initial_urls if url.strip()]
|
||||
return [url.strip() for url in initial_urls if isinstance(url, str) and url.strip()]
|
||||
else:
|
||||
return []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue