Skip to content

Commit

Permalink
Don't crash on invalid JSON in page_config (jupyter-server#1403)
Browse files Browse the repository at this point in the history
  • Loading branch information
holzman committed Mar 12, 2024
1 parent df27810 commit c31fa06
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion jupyter_server/config_manager.py
Expand Up @@ -103,7 +103,10 @@ def get(self, section_name: str, include_root: bool = True) -> dict[str, t.Any]:
for path in paths:
if os.path.isfile(path):
with open(path, encoding="utf-8") as f:
recursive_update(data, json.load(f))
try:
recursive_update(data, json.load(f))
except json.decoder.JSONDecodeError:
self.log.warn("Invalid JSON in %s, skipping", path)
return data

def set(self, section_name: str, data: t.Any) -> None:
Expand Down

0 comments on commit c31fa06

Please sign in to comment.