handle unreadable config paths

This commit is contained in:
Nick Sweeting 2026-08-27 16:14:14 -07:00
parent 41056e0b77
commit 8017245c3f
No known key found for this signature in database

View File

@ -36,12 +36,12 @@ class CaseConfigParser(ConfigParser):
def read_ini_config(config_path: str | Path) -> dict[str, Any]:
"""Read and flatten an ArchiveBox INI config file."""
config_path = Path(config_path)
if not config_path.exists():
return {}
parser = CaseConfigParser(interpolation=None)
try:
if not config_path.exists():
return {}
parser = CaseConfigParser(interpolation=None)
parser.read(config_path)
except (OSError, PermissionError):
except OSError:
return {}
return {key.upper(): value for section in parser.sections() for key, value in parser.items(section)}