Skip to content

Commit a608ea2

Browse files
committed
refactor: improve config path existence and truthiness check before direct access.
1 parent cbd0649 commit a608ea2

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

tooldns/api.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -512,8 +512,8 @@ def _lookup_stdio_config(source_info: dict, database) -> tuple:
512512

513513
for src in sources:
514514
config = src.get("config", {})
515-
if "path" in config:
516-
config_path = Path(os.path.expanduser(config.get("path", "")))
515+
if config.get("path"):
516+
config_path = Path(os.path.expanduser(config["path"]))
517517
if not config_path.exists():
518518
continue
519519
try:
@@ -543,8 +543,8 @@ def _lookup_http_config(source_info: dict, database) -> tuple:
543543

544544
for src in sources:
545545
config = src.get("config", {})
546-
if "path" in config:
547-
config_path = Path(os.path.expanduser(config.get("path", "")))
546+
if config.get("path"):
547+
config_path = Path(os.path.expanduser(config["path"]))
548548
if not config_path.exists():
549549
continue
550550
try:

0 commit comments

Comments
 (0)